LESSON 3.01 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Linked lists
Watch a chain of nodes grow and shrink by rewriting a few pointers.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 3.01 · POINTER BAY6 NODES 288 B · LIST 104 B
01
Stage 1 of 5 · Nodes and pointers
A linked list keeps each value in a node. The node's pointer leads to the next node.
Explain it simply
Each box on the top row is a node: a value plus a pointer, the id of the next node. The nodes sit anywhere in memory, so their ids jump around. The Python list below keeps its items side by side, 8 bytes apart.
A singly linked list of 6 nodes holds 3, 8, 1, 6, 4, 9. head points to node id 2720. The last next pointer is None. Below, a Python list holds the same values in slots 8 bytes apart, from address 7496.
valuepointer, id, addresswalk, new nodeitem movedNone, unlinked
Toy: 4 to 8 nodes · one inserted value · ids are short stand-ins for addresses
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
A node holds a value and a pointer; list slots sit 8 bytes apart.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.