Master Theorem
Let’s learn what a master theorem is and where we can utilize it.
We'll cover the following
Master Theorem
By definition, the master theorem is used to solve recurrence relations. It is stated as = + where, a ≥ 1 and b > 1. In this relation, is the size of the input and is the number of subproblems in the recursion. is the factor by which the size of the subproblem is reduced in each recursive call. Lastly, is the cost of dividing the problem into subproblems and merging the individual solutions of the subproblems into the solution.
We generally have three cases in the master theorem. In other words, we determine an asymptotic tight bound in the following three cases:
Case-1
Case-1 states that when = and constant > 1, then the final time complexity is = . Here
= (Number of subproblems (a) ) / log(the factor by which subproblem size reduces (b) ).
Case-2
Case-2 states that when = and constant > 1, then the final time complexity is = .
Case-3
Case-3 states that when = and constant > 1, then the final time complexity is: = .
Let’s understand the above cases better with a diagram.
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy