We know, linked list is a linear data structure means linked list can not store elements continuously. 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.
In this article, we will discuss the advantages, disadvantages and uses of a doubly linked list.
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 learned about the advantages and disadvantages of a doubly linked list. Or we can say the advantages of a doubly linked list over a singly linked list Also, we learned about its various uses in software. I would highly recommend you to practice some problems on linked list by click here.
What are the different types of linked lists?
Different types of linked lists are:
- Singly-linked list
- Doubly linked list
- Circular linked list
What are the advantages of a linked list?
The advantages of a linked list are:
- Linked lists are dynamic.
- In the linked list, the insertion, and deletion operations are very fast.
- Also, the utilization of memory is used efficiently.
What is a doubly linked list?
It is a type of linked list in which every node consists of data, the previous pointer, and the next pointer of the node.
Can a doubly linked list be a circular linked list?
Yes, a doubly linked list can be circular linked list if the last node of the doubly linked list is connected to the first node of the linked list.