Doubly Linked List in Data Structures: Definition and Operations
☰Fullscreen
Table of Content:
Doubly Linked List : Traverse Bi-directional
- In Doubly Linked List , each node contain two address fields .
- One address field for storing address of next node to be followed and second address field contain the address of previous node linked to it.
- So Two way access is possible i.e We can start accessing nodes from start as well as from last .
- Like Singly Linked List also only Linear but Bidirectional Sequential movement is possible.
- Elements are accessed sequentially, no direct access is allowed.
Explanation
- Doubly Linked List is most useful type of Linked List.
- In DLL we have facility to access both next as well as previous data using “next link” and “previous link“.
- In the above diagram , suppose we are currently on 2nd node i.e at 4 then we can access next and previous data using –
To Access Next Data : curr_node->next->data To Access Previous Data : curr_node->previous->data
- We have to always maintain start node because it is the only node that is used to keep track of complete linked list.