I need to Find the solution of the recurrence for n, a power of two if T(n)=3T(n/2)+n for n>1 and T(n)=1 otherwise.
T(n)=3T(n/2)+n
using substitution of n=2^m,S(
n=2^m,S(
The problems like this can be solved using Masters theorem.
In your case a = 3, b = 2 and f(n) = n.
a = 3
b = 2
f(n) = n
So c = log_b(a) = log_2(3), which is bigger than 1, and therefore you fall into the first case. So your complexity is:
c = log_b(a) = log_2(3)
O(n^{log_2(3)}) = O(n^{1.58})