Skip to main content

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 rear pointer is kept.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Data Structure and Algorithm chapter 4 questions →