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
| Metric | Best | Average | Worst |
|---|---|---|---|
| Time | O(1) | O(n) | O(n) |
| Space | O(n) | ||
Visualization
HEADNULL
10
•
20
•
30
•
40
•
50
∅
Implementation
Output
Click "Run Code" to see output...