Codacoda
Back to Academy

linked lists

Doubly Linked List

A Doubly Linked List is a linear data structure where each node contains data, a reference to the next node, and a reference to the previous node. This bidirectional linking allows efficient traversal in both directions and simplifies operations like deletion when you have a reference to the node. It is widely used in implementing LRU caches and browser navigation history.

Use Cases

  • LRU cache implementation
  • Browser forward and back navigation
  • Undo/redo functionality with bidirectional traversal

Complexity Analysis

MetricBestAverageWorst
TimeO(1)O(n)O(n)
SpaceO(n)

Visualization

HEAD
10
20
30
40
50
NULL
Speed:1x
Linked list createdStep 1 / 7

Implementation

Output

Click "Run Code" to see output...