Lesson 30 of 50 · c
Dynamic Data Structures – Doubly Linked List
Duration: 15 mins
A doubly linked list stores two pointers per node – next and prev. This allows O(1) deletion and reverse traversal.
struct DNode {
int data;
struct DNode *prev;
struct DNode *next;
};
Key operations:
- Insert at head/tail.
- Delete a given node (requires updating both neighbours).
- Traverse forward or backward.
Memory overhead is higher (extra pointer) but many algorithms need bi‑directional access (e.g., LRU cache).