TOPIC

Linked List

Nodes linked by pointers — singly, doubly, circular.

WHY DID WE NEED LINKED LISTS?

THE WALLArrays made insert/delete expensive: shifting n elements just to add one at the front, and resizing means copying the whole block.

THE IDEAGive up contiguity. Each node stores its value PLUS the address of the next node — insertion is just rewiring two pointers, O(1), and the list grows one node at a time, forever.

A treasure hunt: each clue points to the next. Adding a clue mid-hunt is easy — but there is no jumping straight to clue #42.

Choose a category