• Last Updated : 13 Jun, 2022

Doubly linked list is a type of linked list in which nodes contains information and two pointers i.e. left pointer and right pointer. The left pointer in the doubly linked list points to the previous node and the right pointer points to the next node in the linked list. The first node of the doubly linked list has NULL in its left pointer and the last node of the doubly linked list has NULL in its right pointer. It is also known as a two-way linked list as there are two pointers. The benefit of this doubly linked list is that now we can navigate in both directions.  Also, we can delete a node without containing the previous node’s address as every node has a left pointer that points to its previous node.

Working of a Doubly Linked List:

A Doubly linked list node contains three fields:

• Left pointer,
• Information and
• Right pointer.

The left pointer points to the node which is before the current node and the right pointer points to the node after the current node. A Doubly linked list allows backward traversing if required. All other functions are similar to linked list.

It is different from the normal linked list by allowing the bidirectional traversal which in turn reduces the time complexity of any operation.

Insertion:
Insertion into a doubly-linked list has three cases that are as follows:

• Inserting a new node before the head of the linked list i.e. at the beginning.
• Inserting a new node after the tail of the linked list i.e. at the end.
• Inserting a new node at a specific position.

Deletion:
Deletion into a doubly-linked list has three cases that are as follows:

• Deleting the first node.
• Deleting the last node.
• Deleting a specific node.

• Doubly linked list can be used in navigation systems where both forward and backward traversal is required.
• It can be used to implement different tree data structures.
• It can be used to implement undo/redo operations.

Real-Time Applications of Doubly Linked List:

• Doubly linked lists are used in web page navigation in both forward and backward directions.
• It can be used in games like a deck of cards.

• The doubly linked list allows traversing in both forward and backward directions.
• Deletion of the nodes can be done easily.
• Reversing of linked list is easy.
• Insertion can be performed efficiently at any node.