Practice Flashcards
Flip to reveal answersWhat two things define a linked list?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Building linked lists
Sign up free to track progress and get spaced-repetition review schedules.
Question
What two things define a linked list?
Answer
A **Node** holding a value and a reference to the next, and a **head** reference pointing at the first node.
Question
In what order are the two references assigned when inserting?
Answer
**Point the new node forwards first** (new.next ← prev.next), then repoint the previous node (prev.next ← new). The other order overwrites the only reference to the rest of the list.
Question
How is a node deleted from a singly linked list?
Answer
By **routing around it**: prev.next ← target.next. Nothing is erased — the node simply becomes unreachable.
Question
Why is deleting the head a special case?
Answer
There is no previous node to reroute, so the head itself moves: head = head.next.
Question
How does a traversal of a circular list stop?
Answer
When current returns to the **head**. There is no None to test for.
Read the notes
Full study notes for Building linked lists
Topic 8.1 hub
Fundamentals of ADTs
More from Topic 8.1
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free