- 2068 Magh · 2 marks
Doubly linked list and its merits
Short answer
A doubly linked list has nodes with prev and next pointers for bidirectional traversal. Merits: two-way traverse, O(1) deletion of a given node because predecessor is reachable via prev, easy insertion before/after a node, and efficient removal of last node if a rear pointer is kept.
Define doubly linked list and mention its merits.
A doubly linked list is a list whose nodes each contain info and two pointers, prev (to the previous node) and next (to the next node), so the list can be traversed in either direction.
NULL<-[ |A| ]<->[ |B| ]<->[ |C| ]->NULL
Merits
- Two-way traversal (forward and backward).
- Deletion of a given node is O(1) because its predecessor is available through
prev. - Insertion before or after a node is simple.
- Last node can be reached and removed easily if a
rearpointer is kept.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Insert and delete kth node in doubly linked list · Data Structure and Algorithm, chapter 4 · asked 2×
- Doubly vs singly 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
- Insert before Kth node in doubly linked list · Data Structure and Algorithm, chapter 4
- Delete Kth node from doubly linked list · Data Structure and Algorithm, chapter 4