â Lab
ð Linked List â nodes & pointers
Nodes joined by next pointers. Insert/remove at a known node is O(1) (rewire), but finding one is O(n). Reverse flips every pointer.
length
3
head
1
tail
3
index access
O(n)
head â âĶ â null
headâ1nextâ2nextâ3nextânull
what just happened (say it out loud)
Run an operation to see it step by step.
ėŽė: a linked list trades O(1) index access for O(1) structural edits: because nodes are separate allocations wired by pointers, inserting/removing is just rewiring â but there's no address arithmetic to jump to index i, so search is O(n).
âķ deep-dive videos â âlinked list reverse pointers explainedâ