Singly Linked Lists

Lesson 9 of 20

Follow head and curr down a chain of nodes — splice 63 in mid-list, unlink 24, and watch every rewire.

The big picture

Node anatomy

A linked list scatters its values across memory and stitches them together with pointers — trading random access for instant splicing.

Value + next

Each Node holds a value and a next pointer. That is the whole atom — no index, no container.

head is everything

The only named entry point. If a node is unreachable from head, the list has lost it for good.

None ends the chain

The last node’s next is None — walking until None is how every traversal stops.

Splice, don’t shift

Insert after a node = rewire two pointers, O(1). A Python list pays O(n) to shift everything right.

The price

No random access: the 5th value costs 4 hops. You walk from head every single time.