- Doubly linked list(DLL) is the two way storing of the data elements.
- Doubly linked list(DLL) provide Bi-directional traversing.
- Doubly linked list(DLL) is the two-way linked list provide the both direction navigation.
- Doubly linked list(DLL) provide next address pointer as well as previous address pointer ,means we can traverse the forward direction and also in backward direction.
- There is one HeadPointer which always points to the first node.HeadPointer have alot of benefits.
PreNode pointer of first node and nextNode pointer of last node will always contain NULL.
Example :
Node Representation
- In Doubly Linked List(DLL) ,Node is the collection of Data Element and Pointer variable for next Node and previous node.
- We can implement Node in C and C++ by the using of the structure User-define data type.
struct CreateNode
{
int DataElement; // for storing the DataElement
struct CreateNode* nextNode; // for pointing the next node.
struct CreateNode* PreNode; // for pointing the Previous node.
}
Operations of Doubly Linked List
There are following operations ,we can apply on Doubly linked list :
- Insertion of node at beginning(front) in DLL.
- Insertion of node at last(end) in DLL.
- Insertion of node at specific location in DLL.
- Deletion of node at beginning(front) in DLL.
- Deletion of node at last(end) in DLL.
- Deletion of node at specific location in DLL.
- Searching of Data in DLL.
Note : For Complete Explanation of Doubly Linked List Operation ,please Refer above Link.
Disadvantage of DLL
- Space required for all the node for storing the address of next and previous node.
- Insertion and deletion will require more time to complete because more pointer operation is needed.
Applications of DLL
- DLL can be use to implement the LRU(Least Recently Used) and MRU(Most recently used) in Operating system.
- Backward and forward navigation of browser can be implement using DLL.