What is Doubly Linked List ? - data structure tutorial
It is strongly recommended that you must have knowledge of linked lists before. If you dont have any knowledge of linked list then click in this link .
Doubly Linked List is a variety of Linked list wherein navigation is possible in the two different ways, either forward and backward effectively as compared with Single Linked List.
Therefore, in a doubly-linked list, a node comprises of three sections: node information, a pointer to the next node (next pointer), a pointer to the previous node (past pointer).
A doubly linked list containing three nodes having numbers from 1 to 3 in their information part, is shown below.
Advantages over the singly linked list
1) A DLL can be navigated in both forward and reverse way.
2) The deletion operation in DLL is more effective if a pointer to the node to be deleted is given.
In a singly linked list, to delete a node, a pointer to the previous node is required.
To get this past node, here and there the list is traversed.
In DLL, we can get the previous node by utilizing previous pointer.
3) We can rapidly add another node before a given node (
Disadvantages of over singly Linked List
In C++, structure of a node in doubly linked list can be given as :
Insertion Operation
A node can be added in four ways
Add a node at the front
Add a node after a given node
3) Add a node at the end
It is strongly recommended that you must have knowledge of linked lists before. If you dont have any knowledge of linked list then click in this link .
Doubly Linked List is a variety of Linked list wherein navigation is possible in the two different ways, either forward and backward effectively as compared with Single Linked List.
Therefore, in a doubly-linked list, a node comprises of three sections: node information, a pointer to the next node (next pointer), a pointer to the previous node (past pointer).
A doubly linked list containing three nodes having numbers from 1 to 3 in their information part, is shown below.
Advantages over the singly linked list
1) A DLL can be navigated in both forward and reverse way.
2) The deletion operation in DLL is more effective if a pointer to the node to be deleted is given.
In a singly linked list, to delete a node, a pointer to the previous node is required.
To get this past node, here and there the list is traversed.
In DLL, we can get the previous node by utilizing previous pointer.
3) We can rapidly add another node before a given node (
Disadvantages of over singly Linked List
1)
2)
In C++, structure of a node in doubly linked list can be given as :
1.
2.
3.
4.
5.
6.
Basic Operations
The following are the basic operations supported by a list.
·
·
Insertion Operation
A node can be added in four ways
Add a node at the front
Add a node after a given node
3) Add a node at the end