A Linked Lists
03 — Data Structures
A visual guide to nodes & pointers

The Linked List

Values scattered across memory, threaded together by pointers. Cheap to add and remove at the front — but you have to walk the chain to reach anything.

A linked list ditches the array's single big block. Each node sits wherever memory has room and stores two things: its value, and a pointer to the next node. A head marks the start, and the last node points to nothing — null. This flips the array's trade-offs: inserting or removing at the front is just a pointer change with nothing to shift — but there's no jumping to an index. To reach the n-th node, you must follow the chain from the head.

Try it in 3D

Each box is a node; the arrow is its next pointer. head marks the start and the chain ends at null. Press an operation and watch the cost.

Drag to rotate — scroll to zoom
Press an operation to see it animate. ready
Walking the chain Found / added Head pointer Removing

The operations

The mirror image of an array: edits at the front are free, but reaching an index costs a walk.

Cost cheat sheet

Compare this to the array's sheet — the cheap and expensive columns are almost exactly swapped.