Linear Data StructuresIntermediate LevelStudy Time: 22 mins

Doubly Linked List Data Structure

A Doubly Linked List node contains both next and previous pointer references, enabling bidirectional traversal.

Loading visualizer workspace...

Doubly Linked List Bidirectional Relinking Step-by-Step

Sample Input:List: NULL <-> [15] <-> [45] <-> NULL. Target: Delete Node(15)
Step 1

Identify Surrounding Node Pointers

Locate target.prev (NULL) and target.next (Node(45)).

Target: Node(15) | prev: NULL, next: Node(45)
Direct access to both adjacent nodes enables instant node removal.
Step 2

Relink Pointers & Free Node

Set head = target.next (Node(45)), set Node(45).prev = NULL. Free Node(15).

Result: NULL <-> [45] <-> NULL
O(1) deletion achieved because target.prev pointer is known.

Real-world analogy: Two-Way Railway Line

Prev & Next
Hover over items for details

Train cars are connected with couplings in both forward and backward directions, allowing movement both ways.

  • Prev & Next= Pointers linking adjacent nodes bidirectionally.

Operations explained

Complexity analysis

Scenario Simulator: Dataset Size (N = 500)
Presets:
N = 10N = 10,000
Complexity Curve MapDoubly Linked List: O(N) Linear Time
Time (t)Size N (500)N = 500O(N²)O(N log N)O(N)O(log N)O(1)Doubly Linked Li
Time Steps (N=500)

500 steps (Linear)

O(N) Linear Time

Space Footprint

O(1) / O(N) Space

Memory growth rate as N expands.

Performance Rank
Efficient Tier

Relative efficiency rating for large N.

OperationTime ComplexitySpace Complexity
Insert Head / TailO(1)O(1)
Delete Given NodeO(1)O(1)

Code implementations

class Node {
  constructor(val) {
    this.val = val;
    this.prev = null;
    this.next = null;
  }
}

Real-world applications

Case 01

LRU Cache Memory

Moves accessed entries to head instantly.

Case 02

Text Editor History

Navigates undo/redo steps bidirectionally.

Interview questions

Topic Knowledge Test & Assessment

10 Questions Assessment

Doubly Linked List Knowledge & Skill Test

Validate your conceptual understanding, operation mechanics, and core concepts of Doubly Linked List.