Skip to main content

Doubly vs singly linked list

Short answer

Singly linked list has only a next pointer, allowing forward traversal; deletion of a node requires its predecessor. Doubly linked list has both prev and next, supports bidirectional traversal and direct O(1) deletion of a given node, but uses more memory and demands more pointer updates.

How does doubly linked list differ from singly linked list?

BasisSingly linked listDoubly linked list
Pointers per nodeOne (next)Two (prev, next)
TraversalForward onlyForward and backward
Memory per nodeLessMore (extra pointer)
Deleting a given nodeNeeds the previous node (O(n) to find)Done directly, O(1)
Insert before a nodeNeeds previous nodeEasy using prev
Complexity of codeSimpleMore pointer changes, more complex

A doubly linked list gives easier two-way movement at the cost of extra memory and more pointer updates.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 4 questions →