Doubly Linked List

Doubly Linked List

doubly linked list is a data structure that consists of a set of nodes, each of which contains a value and two pointers, one pointing to the previous node in the list and one pointing to the next node in the list. This allows for efficient traversal of the list in both directions, making it suitable for applications where frequent insertions and deletions are required.

 

In C, the structure of a node in doubly linked list struct node  

    struct node *prev;  

    int data; 

    struct node *next;  

}  

The prev part of the first node and the next part of the last node will always contain a null indicating the end in each direction.