Learning path

Full curriculum

Full curriculum

Unit content

Divide-and-conquer recurrence analysis

The running time of a divide-and-conquer algorithm is often described by a recurrence

$$T(n)=aT(n/b)+f(n),$$

where $a$ subproblems of size $n/b$ are solved and $f(n)$ is the work used to divide or combine them.

The quantity

$$n^{\log_b a}$$

captures the total contribution of the recursive branching when each level behaves regularly.

The Master theorem compares $f(n)$ with this quantity. Depending on whether the nonrecursive work grows asymptotically slower, at the same order, or faster, either the recursive levels, all levels together, or the top-level work dominates.

For merge sort,

$$T(n)=2T(n/2)+O(n),$$

and both contributions have the same order, giving

$$T(n)=O(n\log n).$$

The theorem is a convenient pattern, not a universal recurrence solver; irregular splits or unusual $f(n)$ may require other methods.