A Level · Topic 19
Trace recursion and dynamic structures
Compare searches and sorts, reason about a call stack, and choose an abstract data type.
Lessons distinguish AS topics 1–12 from A Level topics 13–20. Examples include Cambridge pseudocode and Python.
Make progress toward the base case
A recursive solution defines a stopping case and reduces every other case toward it. The call stack stores work waiting for a smaller call to return. Trace both the descent and the returns to explain a recursive result.
Binary search reduces a sorted candidate range, while merge sort divides data and combines sorted results. Compare the amount of work and extra storage required. An algorithm's typical behavior does not automatically describe its worst case.
Choose behavior before representation
A stack supports last-in-first-out access, a queue supports first-in-first-out access, and a binary search tree supports ordered navigation. Arrays and linked nodes are implementation choices. Explain empty and full conditions for any bounded implementation.
For a linked insertion, preserve the next reference before changing it. For a tree traversal, define when the node is visited relative to its children. Use a small hand-worked example to verify that every required value is visited exactly once.
Check yourself
Why can a correct recursive algorithm still fail on a very deep input?Show answer
Its pending calls can exhaust available stack space. Correctness and resource limits are different questions.
References used to build these lessons
We used these official documents as references when building this course's lessons. They are the sources for the syllabus structure and course requirements.
Cambridge International · 9618 · Exams 2027–2029