recursionmaster-theorem

Recurrence Relation Master Theorem


T(n) = 6T(n/3) + n * (n-1)
T(1) = 4

If we have a recurrence relation like above, what should we do?

   --> a*T(n/b) + f(n)
   --> a*T(n/b) + O(n^d)
   --> 6*T(n/3) + O((n^2) - n)
   --> 6*T(n/3) + O(n^2)

It seems to like we should use O(n^d). If we go through that way, result is O(n^2).

But I cannot be sure of that. It's like something is missing. Can anyone help to tell is this way true, how to solve this step by step? Thanks in advance.


Solution

  • In my opinion you can continue to apply the theorem to the next step :

    T(n) = 6T(\frac{n}{3}) + n * (n-1)

    T(n) = 6T(\frac{n}{3}) + O(n^{C}) with c=2

    \rightarrow T(n) = O(N^{2})

    According to the 1rst generic form of the master theorem : wikipedia