Skip to content

Master Theorem

The Master Theorem helps you find the time complexity of many recursive algorithms of the form:

Where:

  • → number of recursive calls
  • → size reduction in each recursive call
  • → cost outside the recursive calls (e.g., sorting, merging)

Use Master Theorem to directly find the Big-O time complexity without full recursion tree expansion.


Compare with :

CaseConditionResult
Case 1, for some
Case 2
Case 3, and regularity condition holds

It’s the cost of the recursion tree (total work across all levels). Compare this with to decide which case applies.


  • , ,
  • Case 2


  • , ,
  • Case 1


  • , ,
  • , and satisfies the regularity condition → Case 3


Compare with :

CaseIf is…Then
1Smaller
2Equal
3Larger + regular