Master Theorem the Master Theorem applies to recurrences of
Solution
In a recurrence of the form:
T(n)=aT(n/b)+O(nd)
Case 2 of the master theorem applies when we do equal work at every level of the recursion tree. This happens when the amount of work done at the root - O(nd) - is equal to the amount of work done at the leaves. In other words, when the rate of subproblem proliferation (RSP) is equal to the rate of work shrinkage (RWS) per subproblem:
The RSP is a=3a=3 in your recurrence. This means that, as we move down the tree, we have more subproblems to solve (which is bad news). In particular, at level j, we have 3j subproblems.
The RWS is bd=31=3 in your recurrence. This means that, as we move down the tree, each subproblem does less and less work (which is good news). In particular, at level j, each subproblem accounts for O(n/3j) of the total amount of work.
Since a=bd , the RSP and the RWS cancel out. Thus, it is easy to predict what the running time will be. Since we have a logarithmic number of levels - log(n) - and the total amount of work is the same at every level - O(n) ,then the running time is O(nlog(n)) using Case-2
