Unit 02

Linked Lists

Instead of one continuous memory block, each element lives in its own node and points to the next one. Nothing needs to shift when you insert or remove — you just rewire a couple of pointers.

4 ●→ 9 ●→ 2 ●→ 7 head → 4 → 9 → 2 → 7 → null

// each node only knows about the one after it

What it is

A linked list is a chain of nodes, where each node stores a value and a reference (pointer) to the next node. The list itself only needs to remember where the chain starts (the "head"). There's no requirement that nodes sit next to each other in memory — they can be scattered anywhere.

Why it's useful

Where it struggles

Time complexity

OperationTime
Access by positionO(n)
Insert / delete at headO(1)
Insert / delete at known nodeO(1)
SearchO(n)

Quick check

← Arrays & Strings Next: Stacks & Queues →