TOPICS
Search

Master Theorem


The master theorem uses asymptotic notation to give bounds for divide-and-conquer algorithm recurrences of the form

 T(n)=aT(n/b)+f(n)
(1)

with a>=1 and b>1. Write c=log_ba. In its standard form, the theorem gives

 T(n)={Theta(n^c)   if f(n)=O(n^(c-epsilon)) for some epsilon>0; Theta(n^cln^(k+1)n)   if f(n)=Theta(n^cln^kn) for some k>=0; Theta(f(n))   if f(n)=Omega(n^(c+epsilon)) and the regularity condition holds.
(2)

The regularity condition in the third case requires af(n/b)<=qf(n) for some q<1 and all sufficiently large n, meaning for every n beyond some fixed threshold. The condition ensures that the nonrecursive work decreases geometrically from one recursion level to the next. In the cases above, O is big-O notation for an asymptotic upper bound, Omega is big-omega notation for an asymptotic lower bound, and Theta is big-theta notation for a matching upper and lower bound. Recurrences falling between these cases require other methods.


See also

Asymptotic Notation, Big-O Notation, Big-Omega Notation, Big-Theta Notation, Divide-and-Conquer Algorithm, Recurrence Equation

Explore with Wolfram|Alpha

References

Cormen, T. H.; Leiserson, C. E.; Rivest, R. L.; and Stein, C. Introduction to Algorithms, 2nd ed. Cambridge, MA: MIT Press, 2001.

Cite this as:

Weisstein, Eric W. "Master Theorem." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/MasterTheorem.html

Subject classifications