Community resourceWorksheet
OCR H446 1.4.2 Linked lists: traversal and search
Part 5 of 14 · H446 1.4.2 · Data structures
Logical order in a linked list follows the links, not the row order of the array that stores the nodes, and that distinction is where students most often go wrong in H446 1.4.2. Using a playlist held as an array of nodes, this worksheet establishes the traversal invariant and applies it to searching.
Students will:
- identify head, data, next and the null value that ends a list
- reconstruct the logical order of a list from an array of nodes
- trace a search, separating a successful stop from reaching the end of the list
- write a search that returns the index holding a target or reports its absence
- compare following links with direct array indexing when retrieving a distant item
Inside: 7 explanation cells, 1 multiple-choice question, 1 fill-in-the-blanks cell, 3 written answers, 1 Python task and 1 trace table. 21 marks, about 40 to 50 minutes.
Series: H446 1.4.2 · Data structures, part 5 of 14.
Shared by Coding PathwayVerified teacher
- 14 cells
- About 45 minutes
- CC BY-SA 4.0
- Shared 31 Aug 2026
- Updated 1 Oct 2026
Preview
The whole resource, exactly as a class sees it. Answers and marking are held back.
Linked lists: nodes, traversal and search
A linked list stores each item in a node. The node contains the item’s data and a link to the next node. A playlist can therefore change its logical order without moving every later item in memory. The links, rather than the physical array positions, define the order.
By the end, you will be able to
- identify the head, data, next pointer and null marker;
- reconstruct logical order from an array of nodes;
- traverse and search safely;
- explain the benefit of resizing at run time and the cost of following links.
Follow links, not rows
Start at head 3. Read Maya, move to next 0; read Noor, move to 4; read Sol, move to −1/null and stop. Scanning array indexes 0,1,2... would not produce list order.
The traversal rule
The variable current identifies the node to visit next. The rule that must remain true is that current is either a valid node or the null marker. While current is not null, process the current node’s data and then replace current with the node’s next pointer.
A search adds one decision. If the current data equals the target, report success. Otherwise, follow the next pointer. In an empty list, head is null, so the loop runs zero times.
For the diagram, what is the logical list order?
- AMaya, Noor, Sol
- BNoor, Maya, Sol
- CSol, Noor, Maya
- DArray indexes 0,3,4
Trace traversal of an array-of-nodes linked list.
Enter a value only when it changes. Follow pointers and output in execution order.
Use one row for each pass through the loop. Fill in a box only when that value changes on that row, and leave the rest blank.
data = ["Noor", "", "", "Maya", "Sol"]nextIndex = [4, -1, -1, 0, -1]current = 3while current != -1:print(data[current])current = nextIndex[current]
| Row | data | nextIndex | current | current != -1 | Output |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 | |||||
| 7 |
Guided search
Create columns current, data[current], match? and next. Search for Sol. Stop immediately when found. Then repeat for Ari and reach null. This distinguishes successful termination from exhausted-list termination.
Using the diagram, trace searches for Noor and Ari. Give visited node indexes and final outcome for each.
Start from head=3 and follow each next pointer in logical order.
Students type their answer here.
Independent transfer: write search
Return the node index containing target or -1 if absent. Inputs are data, next_index and head.
def linked_search(data, next_index, head, target):
current = head
while current != -1:
if ...:
return current
# Follow the link stored in the current node.
current = ...
return -1Compare linked-list access with array direct indexing for retrieving the 100th logical item.
Explain mechanism and consequence.
Students type their answer here.
A music service does not know in advance how many tracks a user will add. Explain one benefit and one cost of using a dynamic linked list rather than a fixed-size array.
Refer to what happens while the program is running. Do not write only that one structure uses more memory.
Students type their answer here.
Closed-book checkpoint
Complete each sentence from memory. There is no answer bank and correctness is held for teacher review.
Review your work
Check that traversal begins at head, follows next pointers and stops at the null marker.