1.
Introduction
2.

3.
4.
5.
Uses of Doubly Linked List (DLL)
6.
6.1.
What are the different types of a linked lists?
6.2.
6.3.
6.4.
Can a doubly linked list be circular?
6.5.
7.
Conclusion
Last Updated: Mar 27, 2024
Easy

Yukti Kumari
Crack Google SDE interview : Essential projects
Speaker
Saurav Prateek
SDE-2 @
20 Jun, 2024 @ 01:30 PM

## Introduction

Linked List is a linear data structure where each element has a pointer pointing to the next, forming a sequence of elements. Unlike an array, elements in the linked list are not stored in contiguous memory locations; instead, they are stored at random locations connected through pointers.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

• It allows traversing in both forward and backward directions because of the next and previous pointers, unlike the singly linked list, which allows traversing in only one direction.

• Deletion of elements is more straightforward compared to a singly linked list. This is because to delete an element, we need access to the element to be deleted and the element previous to it. So, we require two pointers for deletion in a singly linked list. In contrast, in a doubly-linked list, there is no need to maintain an extra pointer as each element carries the information of the previous element.

• Reversing a doubly linked list is also easy. We only need to swap each elementâ€™s next and previous pointers and update the head element to point to the last element to reverse a doubly-linked list.

• We can easily insert a  new element before a given element because we have information for both previous and next element so we can update it accordingly.

• It is very easy to implement.

• It consumes extra memory space compared to a singly linked list due to the additional previous pointer it has to maintain for each element.

• It is impossible to access the listâ€™s elements directly because they are stored at random locations, and we can only access them sequentially.

• All the operations require more time due to the overhead of handling extra pointers. For instance, if you have to insert a new element, you must modify the previous pointers and the next pointers, similarly in the case of deletion.

## Uses of Doubly Linked List (DLL)

In this section, we will see some of the practical applications of the doubly linked list.

• It is used in web browsers to implement the backward and forward navigation of web pages through the back and forward buttons.

• Various applications implement the Undo and Redo functionality using a doubly-linked list.

• Doubly linked lists are used in constructing the Most recently used(MRU) or Least Recently Used(LRU) cache.

• It is used in games. For example, to represent the classical deck of cards.

• Various Data Structures can be implemented, like stacks, hash tables, binary trees etc.

• The thread scheduler uses them in the operating system to maintain a list of all the running processes.

Also see, Rabin Karp Algorithm

### What are the different types of a linked lists?

The advantages of a linked list include that it is dynamic in nature, the deletion and insertion are very fast and the memory is utilised efficiently in linked lists because we donâ€™t need to declare size in advance.

### What is a doubly-linked list?

A doubly linked list is one of the types of linked lists in which each element consists of data and pointers to the previous and the next elements.

### Can a doubly linked list be circular?

Yes, a doubly-linked list in which the last element and the head element are adjacent is said to be a circular doubly-linked list.

### Why doubly linked list is better than singly linked list ?

Doubly linked list contains two pointers namely â€śnextâ€ť and â€śpreviousâ€ť due to which accessing elements in a doubly linked list is easy compared to singly linked list as both forward and backward traversal is possible.