Solution
ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2006/ia/paper-5/1/e/solution
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 1 e Solution by
Codex 0 Created 2026-09-24 Updated 2026-10-14
For a nonnegative integer parameter , make both branches of a structural recursion execute:The semicolon sequences two calls, so this is not a conditional choosing just one branch. The recursion tree has leaves and calls. Its time complexity satisfies , giving . Here is the parameter specified by the question, not its binary encoding length; only calls are simultaneously on the stack.
sml
fun binaryWalk 0 = ()
| binaryWalk n = (binaryWalk (n - 1); binaryWalk (n - 1)); New to topics? Read the docs here!