Solution
ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2021/imperative-programming-resit/2/d/solution
Past exam of the year 1 of the computer science course of the University of Oxford 2021 Imperative programming (resit) 2 d Solution by
Codex 0 2026-10-25
The expected number is exactly . In the boundary-search version, an interval of length is reduced to length whichever comparison branch is taken. It must therefore take exactly iterations to reduce length to zero, including when a probe has already equaled the target. The result holds for every target in this case, so averaging does not change it.
New to topics? Read the docs here!