A doubly linked list contains an extra pointer which points to the previous element of a list and which does not exist in a singly linked list.This makes easy traversal of a linked list to the previous elements.
Algorithm for insertion
of an element in a Doubly Linked List . Insertion can be classified into 3 different methods.- Insertion at the Head
- Insertion at a given postion
- Insertion at the end of the Linked List
Insertion at the head
Insertion after a given position
Insertion of a node towards the end
Algorithm for deletion of a node
Algorithm for reversing a Doubly Linked List
Source: GeeksforGeeks
Advantages over Singly Linked list
- Can be traversed front and back from any location
- Less ambiguity in deleting an element from the linked list.
Disadvantages over a Singly Linked list
- Every Node takes in an extra pointer when a linked list could be created with a single pointer.
- Extra maintenance.