Doubly Linked List | Program | Traversing Operation | Data Structures

preview_player
Показать описание
In this Python Programming video tutorial you will learn about doubly Linked List data structure and also you will write the program for traversing operation in detail.

Data structure is a way of storing and organising the data so that it can be accessed effectively.
Linked List is a linear data structure made up of chain of nodes in which each node contains a data field and link or reference.

There are different types of linked list. Here we will discuss about 3 common types of linked list. doubly linked list is one of them. Here we will discuss doubly linked list operations and definitions in detail.

Here we will write two methods for traversing operation, one is for forward traversing and another for backward traversing.

Forward Traversing:
def print_LL(self):
print("Linked List is empty!")
else:
while n is not None:

Backward Traversing:
def print_LL_reverse(self):
print()
print("Linked List is empty!")
else:
while n is not None:


#DataStructures #PythonPrograms #LinkedList

For more free tutorials on computer programming
Рекомендации по теме
Комментарии
Автор

wow its really good mam, i watch lot of data structure videos, those videos are really tough to understand but your videos are good, i quickly understand the data structure and the explanation, examples are good to under stand, thank you

SujithSujith-zlho
Автор

14:00 Why didn't we use,
while n.pref is not None: ??
instead of, while n is not None:

arnavverma
Автор

Best lecture, best technique, keep it up :).

nayankamthe
Автор

why don't you take self.tail as a parameter, it will easy to print backwards having self.tail

deepakmehra
Автор

mam, you very clearly teach the concepts of linked list so that thank you mam , so could you upload a video for singly and doubly circular linked list mam.

factsworldtamil
Автор

Music player is one of the best example for linked list right?

t.gowthamarasu
Автор

You have made many playlist wich one learn first

sahilsahane
Автор

Mam we can create a another instance variable in doublelinked list class. And travel easily in reverse order. In that case we need not to travel to last node to find it. Right mam?

rohankhatua
Автор

Can u please Start Circular Linked List after it? Please!!

shaikafridi
Автор

ma'am when I'm going to execute it's coming name "dll" not found

priyankakadam
Автор

I'm not getting the o/p as you got !!!!
please suggest

rebelsk
Автор

Can you elaborate on the meaning of nref and pref, please?

nguyenhuyhoangkhcm
Автор

Mam how can we write this code as menu driven in python

anusree
Автор

How can I generate ramdom doubly linked list
please help me

jaypeepcanlas
Автор

In reverse transversal first node is not printing

chaitanyamutyala
Автор

Mam expalin difference between while n is not none and while n.nref is not none

Badboy-dxti
Автор

when to use while n.ref is not None and when to use while n is not None ??

manishbolbanda
Автор

Can you make reverse operation in single list

FindMultiBagger
Автор

class Node:
def _init_(self, data):
self.data = data
self.nref = None
self.pref = None

class doublyLL:
def _init_(self):
self.data = None

def print_LL(self):
if self.head is None:
print ("Linked list is empty")
else:
n=self.head
while n!= None:
print(n.data, "-->", end=" ")
n = n.nref

def print_LL_reverse(self):
if self.head is None:
print ("Linked list is empty")
else:
n=self.head
while n.nref is not None:
n = n.nref
dl1=doublyLL()
dl1.print_LL()


ERROR : -Traceback (most recent call last):
File "<string>", line 28, in <module>
File "<string>", line 12, in print_LL
AttributeError: 'doublyLL' object has no attribute 'head'
>

rebelsk
Автор

class Node:
def __init__(self, data):
self.data = None
self.nref = None
self.pref = None
class doubly_LL:
def __init__(self):
self.head = None

def print_LL(self):
if self.head is None:
print("Linked List is Empty")
else:
n = self.head
while n is not None:
print(n.data, "--", end = " ")
n = n.nref

def reverse_print_LL(self):
if self.head is None:
print("Linked List is Empty")
else:
n = self.head
while n.nref is not None:
n = n.nref
while n is not None:
print(n.data, "--", end = " ")
n = n.pref

def linked_list_empty(self, data):
if self.head is None:
new_node = Node(data)
self.head = new_node
else:
print("Linked List is Not Empty")

def add_begin(self, data):
new_node = Node(data)
if self.head is None:
self.head = Node(data)

else:
new_node.nref = self.head
self.head.pref = new_node
self.head = new_node









obj = doubly_LL()
obj.linked_list_empty(10)
obj.add_begin(20)
obj.print_LL()
obj.reverse_print_LL()




I am getting output as None None .
Any one can help me ?

gandeswaraj
join shbcf.ru