A doubly linked list is a linear data structure similar to a singly linked list but here each node has an extra pointer that stores the address of the previous node corresponding to each node.
Let’s look at various advantages and disadvantages along with some uses of a doubly linked list.
Advantages of a Doubly Linked List
- Allows us to iterate in both directions.
- We can delete a node easily as we have access to its previous node.
- Reversing is easy.
- Can grow or shrink in size dynamically.
- Useful in implementing various other data structures.
Disadvantages of a Doubly Linked List
- Compared to a singly linked list, each node store an extra pointer which consumes extra memory.
- Operations require more time due to the overhead of handling extra pointers as compared to singly-linked lists.
- No random access of elements.
Uses of a Doubly Linked List
- It can be used to implement various other data structures like hash-tables, stacks, binary trees etc.
- Can be used to implement functionalities such as undo/redo.
- Can be used in any software which requires forward and backward navigation e.g. music players, in web-browsers to move between previously visited and current page etc.
- Used by a thread scheduler in many operating systems to maintain a list of all running processes.
- Can also be used in games e.g. representing a deck of cards.
Through this article, we came to know about the advantages and disadvantages of a doubly linked list. Also, we learned about its various uses in software. I would highly recommend you to practice some problems on linked list from Linked List.