Complete example
Build and traverse a linked list
Read the entire Node class from the workshop, follow the two-node trace, watch the short clip and try original questions.
Loading…
Free A-Level Computer Science guide
A linked list makes references visible: each node contains a value and a way to reach the next node. Learn the model before reading the full Python example.
Content owner: Michael Print · Written for A-Level learners · Checked against official specifications
A data structure organises values and defines useful operations on them. A singly linked list keeps a reference to its first node, usually called the head. Each node holds a value and a reference to the next node; the final reference is None in our Python example.
To visit every value, start at the head, process the current node, then follow its next reference until there is no next node.
The arrows mean references to another node. The values are not the references themselves. Repointing the node containing 5 to a later node changes which nodes can be reached from the head.
In this 73-second captioned workshop excerpt, Michael draws nodes linked by references, shows how mylist[0] reads the first item in a Python list, and then changes one reference to skip two nodes.
Python's built-in list also supports removal. The clip focuses on the different way a linked structure is followed and changed.
Complete example
Read the entire Node class from the workshop, follow the two-node trace, watch the short clip and try original questions.
Python foundation
Understand classes, objects, attributes, methods and encapsulation through a separate runnable example.
These are independently written explanations and practice questions. CompSciTutoring.co.uk is not affiliated with or endorsed by an examination board. The marking guidance is indicative; always check the syllabus for your examination year.
Found an error? Email a correction.
Use the free examples first, then explore one-to-one tuition if guided practice would help.