Advantages, Disadvantages, and uses of Doubly Linked List
A Doubly Linked List[DLL] is a linear data structure that contains an extra pointer, typically called the previous pointer, together with the next pointer and data which are there in a singly linked list. Below is the image to illustrate the same.
Advantages Of DLL:
- Reversing the doubly linked list is very easy.
- It can allocate or reallocate memory easily during its execution.
- As with a singly linked list, it is the easiest data structure to implement.
- The traversal of this doubly linked list is bidirectional which is not possible in a singly linked list.
- Deletion of nodes is easy as compared to a Singly Linked List. A singly linked list deletion requires a pointer to the node and previous node to be deleted but in the doubly linked list, it only required the pointer which is to be deleted.
Disadvantages Of DLL:
- It uses extra memory when compared to the array and singly linked list.
- Since elements in memory are stored randomly, therefore the elements are accessed sequentially no direct access is allowed.
Uses Of DLL:
- It is used in the navigation systems where front and back navigation is required.
- It is used by the browser to implement backward and forward navigation of visited web pages that is a back and forward button.
- It is also used to represent a classic game deck of cards.
- It is also used by various applications to implement undo and redo functionality.
- Doubly Linked List is also used in constructing MRU/LRU [Most/least recently used] cache.
- Other data structures like stacks, Hash Tables, Binary trees can also be constructed or programmed using a doubly-linked list.
- Also in many operating systems, the thread scheduler[the thing that chooses what process needs to run at which time] maintains a doubly-linked list of all processes running at that time.
Introduction
In this article, we will explore the advantages, disadvantages as well as uses of doubly-linked lists.
We know that alinked listis a linear data structure that does not store the elements at contiguous memory locations. Rather, they are stored at random locations connected through pointers.
There are three types of linked lists:
- Singly Linked Lists
- Doubly linked lists
- Circular Linked Lists
First, let’s see what a doubly-linked list is and how it differs from a singly linked list?
In a singly-linked list, each node contains two pieces of information: data and pointer to the next node. But in the doubly linked list, each node contains an extra piece of information called the previous pointer. The previous pointer points to the previous node corresponding to each node in the linked list.
Quick Answer: What Are The Advantages And Disadvantages Of Linked List?
Feb 09 2022