The big idea: Two things make a linked list: a Node that holds a value and a reference, and a head reference that points at the first node.
Lose the head and the whole list is unreachable — nothing else points at the first node.
None marks the end: The last node's next is None. That is the only thing distinguishing the end of the list from the middle of it — which is why every traversal tests for it.
Free preview
This is the free notes preview
You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:
- FlashcardsLock in vocabulary and key terms with spaced repetition.
- Practice questionsAnswer exam-style questions and get instant AI marking.
- Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
- Personalised study planA daily plan built around your exam date and weak areas.
Traverse
Insert at the front
Insert after a node
Delete
Traverse
Insert at the front
Insert after a node
Delete
Deleting the first node is the special case: There is no prev for the head. Deleting it means moving the head itself — head ← head.next.
An answer that handles only the middle case is incomplete, and this is the case examiners choose.
Feeling unprepared for exams?
Get a clear study plan, practice with real questions, and know exactly where you stand before exam day. No more guessing.
| Doubly linked | Circular | |
|---|---|---|
| Node holds | value, next, prev | value, next |
| End of list | next is None | next points at the head |
| Traversal stops when | current is None | current is back at the head |
| Insertion updates | Four references | Two |
| Deleting needs | Only the node itself | The node before it |
Four references, not two: Inserting into a doubly linked list updates the new node's next AND prev, the previous node's next, and the following node's prev.
Miss one and traversal works in one direction and breaks in the other — a bug that hides until something walks backwards.
Circular traversal: <pre><code>current = head while True: print(current.value) current = current.next if current is head: break</code></pre>The stop test is identity with the head, not None. Say that explicitly.
Circular traversal: <pre><code>Node current = head; while (true) { System.out.println(current.value); current = current.next; if (current == head) { break; } }</code></pre>The stop test is identity with the head, not None. Say that explicitly.
How this is tested — you must write or trace the reference assignments in the right ORDER, and handle the head as a special case. It comes up two ways:
Paper 2 — working with code
- Construct code for an operation, 4-6 marks
- Trace what a list looks like after operations
- Sketch the list as boxes and arrows
Paper 2 — the algorithmic-thinking question
- Explain why an order of assignment matters
- Identify the case an implementation fails on
The classic trap: Assigning prev.next ← new before new.next ← prev.next. The first assignment overwrites the only reference to the rest of the list, and everything after it is lost.
Write a Python function that deletes the first node whose value equals a target from a singly linked list, handling the case where it is the head.
Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.