A doubly linked list stores data in nodes, each with pointers to the previous and next nodes. The links allow traversal in either direction. Compared with arrays, it avoids shifting elements when inserting or deleting, but uses extra memory; finding a position still requires traversal. section 1.4.2
Doubly linked list
A doubly linked list is a linked list whose nodes contain pointers to both the previous and next nodes.
How Algorithms Every Programmer Should Know covers it
- How deep it goes
- Defines bidirectional links and discusses traversal, memory cost, and insertion before showing a Python append implementation.
- Examples
- Uses a three-node pointer diagram and Python code that appends nodes and displays the list forward.
- What you can do after
- Understand when two-way traversal and pointer-based updates suit a task, while accounting for extra memory.
- How it connects
- Connects linked lists with arrays, hash maps, queues, and Python's deque.
Also explained in
-
Grokking Data StructuresA doubly linked list is a linked list in which each node contains links to both its previous and next nodes, supporting traversal in both directions.
-
Acing the Frontend InterviewA doubly linked list is a linked sequence whose nodes contain references to both their preceding and succeeding nodes.
-
Advanced Algorithms and Data StructuresA doubly-linked list is a linked list whose nodes contain links to both their predecessors and successors.
Compare how 4 books explain doubly linked list →
Related concepts
- linked listkind of · An ordered sequence of elements stored in separate nodes connected by links or references rather than in one contiguous storage region.
- listkind of · A list is an ordered collection of elements arranged in a sequence.
- concatenationimplements · Concatenation is the operation of joining ordered sequences end to end, or along a specified dimension, to form a combined sequence or structure.
This explainer was generated by Manning's knowledge graph from the text of Algorithms Every Programmer Should Know. The section links point to the parts of the book it draws on.



