Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2019/functional-programming-design-and-analysis-of-algorithms/5/a/solution

A divide-and-conquer algorithm handles a small input directly; otherwise it divides the input into smaller instances, recursively solves them, and combines their answers. With equally sized subproblems of size approximately and nonrecursive work , its recurrence relation has the form , with constant-size base cases, and .
Write . The basic master theorem gives the following cases, with a fixed :
  • If , then .
  • If , then .
  • If and the regularity condition holds eventually for some , then .
For the common extended middle case, with fixed gives . A recursion tree explains the three cases: work is dominated by its leaves, spread across comparable levels, or dominated by its top levels. The regularity condition in the last case is part of the theorem, not an optional simplification.

New to topics? Read the docs here!