AI engineering glossary · Data structures algorithms
What is master theorem?
Master theorem: A formula that directly gives the asymptotic solution of divide and conquer recurrences of the form T(n) = aT(n/b) + f(n) by comparing f(n) with n^(log_b a). It saves solving each recurrence by hand.
Master theorem: an example
For T(n) = 2T(n/2) + n we have a = 2, b = 2, and f(n) matches n^1, so the result is Theta(n log n).
Related terms
More Data structures algorithms terms
- Memoization
- Merge sort
- Minimum spanning tree
- Monotonic stack
- NP-complete
- Open addressing
- Optimal substructure
- Overlapping subproblems
Where you learn it
Master theorem is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.