I am trying to solve a recurrence by using substitution method. The recurrence relation is:
T(n) = 4T(n/2) + n^3 + n*(log(n))^2
I tried to solve this also with master method.
I am trying to solve a recurrence by using substitution method. The recurrence relation is:
T(n) = 4T(n/2) + n^3 + n*(log(n))^2
I tried to solve this also with master method.
On
From the point of view of a time complexity, T(n) = 4T(n/2) + n^3 + n*(log(n))^2 is the same as T(n) = 4T(n/2) + n^3.
Now using a master theorem, you have a=4, b=2 and therefore c = logb(a) = 2. Because n^c grows slower than your f(n) = n^3, you fall into the third case and the time complexity is O(n^3)
First supstitution you can use is
n = 2^k. Your recurrence becomes:or
where
c = (log 2)^2.After another supstitution,
S(k) = T(2^k)and dividing by4^kwe getOur final supstitution is
R(k) = S(k) / 4^kand the new recurrence isBy telescoping (ie. summing these equations for k = 2, 3, ..., n) we get
(where both sums go from k = 1 to k = n - 1).
Finally,
T(2^k)can easily be found from the last equation. For other values ofT(n)(when n is not a power of 2), you don't have enough data without additional assumptions (continuity, for example).