What the lesson covers
A linked list stores items in nodes scattered in memory, each pointing to the next. Students follow the pointers from the head, insert a node by changing just two links and compare linked lists with arrays.
The slides, one by one
1 Linked lists
A chain of pointers
How can you insert into a list without moving everything along?
2 Insert by changing two pointers
1: the new node points to 20
2: node 10 points to the new node
3 Linked lists trade fast inserts for slow access
Array
- Jump to any index at once
- Insert: shift the items after
- One block of memory
Linked list
- Follow pointers from the head
- Insert: change two pointers
- Nodes anywhere in memory
Choose by what you do most: reading or inserting
4 Inserting 15 after 10
A list holds 10 → 20 → 30. Insert a node with 15 after the node holding 10.
→ Point the new node at the old next node first, then relink
\text{new} = \text{Node}(15)
\text{new.next} = \text{node10.next}\ (= 20)
\text{node10.next} = \text{new}
10 \to 15 \to 20 \to 30
Two pointer changes, and nothing else moves
5 Quick check
To read the 50th node of a linked list, starting from the head, you follow…
- 1 pointer
- 49 pointers
- 50 × 50 pointers
- No pointers
Show the answer
49 pointers
The head is node 1; each step along a pointer reaches the next node, so 49 steps reach node 50.
6 What to remember
Node = value + pointer to the next
Start at the head, end at null
Insert or delete: change pointers
Access by index: follow the chain
Challenge: Why would you set new.next before changing node10.next, not after?
Every slide is built click by click: text, formulas and pictures come in one step at a time, so the class follows the reasoning instead of reading ahead. Graphs with sliders can be dragged live while you present.
Make your own version with AIChange the level, the numbers or the language: type the topic and get a new deck that moves in about 30 seconds. Free, no account needed.
Questions teachers ask
What is the advantage of a linked list over an array?
Inserting or deleting at a known position only changes a couple of pointers, so nothing has to be shifted. The cost is that you cannot jump to the k-th item: you must follow k pointers from the head.
Are these slides really free?
Yes. Watch them on this page or present them full screen with no account. Making your own copy to edit is free too.
Can I change the slides before my lesson?
Yes. Press "Make my own copy" and the deck becomes one of your projects in the Tracé editor, where you can change the text, the numbers, the colours or the order of the clicks.
Do they work on a classroom projector or an interactive whiteboard?
Yes. They run in the browser on any laptop, so anything that shows your screen works. Press the right arrow or click to go to the next step.