Doubly linked list in Data Structure

Rumman Ansari   Software Engineer   2023-03-27   7075 Share
☰ Table of Contents

Table of Content:


Doubly Linked List : Traverse Bi-directional

  1. In Doubly Linked List , each node contain two address fields .
  2. 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.
  3. So Two way access is possible i.e We can start accessing nodes from start as well as from last .
  4. Like Singly Linked List also only Linear but Bidirectional Sequential movement is possible.
  5. 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
    
    1. We have to always maintain start node because it is the only node that is used to keep track of complete linked list.