Beginner Topic 4 of 52 Data Structures
Doubly Linked Lists
Linked nodes with both next and previous pointers.
How it works
In a doubly linked list each node keeps both next and previous pointers, so you can traverse in either direction and remove a node in O(1) given only a reference to it, without finding its predecessor. Head and tail pointers make insertion at both ends constant time. Each node costs one extra pointer of memory.
Where it is used
LRU caches, browser history, text-editor buffers, music playlists and implementations of deques use doubly linked lists. Java LinkedList and the C++ list are doubly linked.
Common pitfall
There are twice as many pointers to keep consistent, and a missed update leaves the list corrupted in one direction. Sentinel nodes simplify edge cases at the ends. Memory overhead and poor cache locality make arrays preferable when you do not need cheap middle edits.
Where it fits in the course
Doubly Linked Lists is topic 4 of 52 in Data Structures, rated Beginner. It follows Linked Lists. The next topic is Circular Linked Lists.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Data Structures quiz.
- Explore the Stack, Queue & Linked List visualizer: Push, pop, enqueue and dequeue interactively.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Data Structures quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Doubly Linked Lists?
Where do people use Doubly Linked Lists?
What is the most common mistake with Doubly Linked Lists?
What should I learn before this topic?
How can I practice it?
Is Doubly Linked Lists hard to learn?
How long does it take to learn Doubly Linked Lists?
Which topics are related to Doubly Linked Lists?
What should I study after Doubly Linked Lists?
Related topics
- Linked Lists (Data Structures)
- Circular Linked Lists (Data Structures)
- Dynamic Arrays (Data Structures)
- Stacks (Data Structures)
- Arrays and Lists (Programming Fundamentals)