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.

Level: advancedTopic: Data structures algorithms

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.