- Asked 2/14
- 2069 Poush · 2 marks
- 2068 Bhadra · 2 marks
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?
| Basis | Singly linked list | Doubly linked list |
|---|---|---|
| Pointers per node | One (next) | Two (prev, next) |
| Traversal | Forward only | Forward and backward |
| Memory per node | Less | More (extra pointer) |
| Deleting a given node | Needs the previous node (O(n) to find) | Done directly, O(1) |
| Insert before a node | Needs previous node | Easy using prev |
| Complexity of code | Simple | More 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)
Related questions
- Singly vs doubly linked list · Data Structure and Algorithm, chapter 4
- Doubly linked list: bank customer records · Data Structure and Algorithm, chapter 4
- Insert and delete before a node, singly linked · Data Structure and Algorithm, chapter 4
- Insert and delete kth node in doubly linked list · Data Structure and Algorithm, chapter 4 · asked 2×
- Delete last node of doubly linked list · Data Structure and Algorithm, chapter 4
- Doubly linked list advantages and disadvantages · Data Structure and Algorithm, chapter 4