edited by
1,255 views
3 votes
3 votes

How to apply Master's Theorem

(i) $T(n)= T(\frac{n}{2})+2^{n}$

(ii) $T(n)=2^{n}T(\frac{n}{2})+n^{n}$

edited by

2 Answers

1 votes
1 votes

T(n) = T(n/2)+2n

Applying Master theorem nlog2=n0=1

f(n)=2n 

Here 2n >1

So, T(n)= O(2n)

T(n)=2n.T(n/2)+nn

Applying Master theorem n log 2^n =nn

f(n)=nn

So, T(n)=O(nn log n)

0 votes
0 votes
master theorem is applicable to following type only.

T(n)= a T($\frac{n}{b}$) + $n^k log^pn$

here both are not of form . so can't apply as a and b should be constant.  in the second case a is not constant it is a function of n. solve by reccurence relation. or by back substitution.

Related questions

0 votes
0 votes
1 answer
1
Rajucse asked Aug 21, 2018
391 views
T(n)=T(n-1)+O(n)Can we apply master's theorem here ??
0 votes
0 votes
2 answers
2
Soham.SR asked Jul 16, 2018
808 views
Find the time complexity using Master's theorem : (Also mention if Master's theorem can't be applied why not?)T(n)=2T(n/2)+nlogn
7 votes
7 votes
3 answers
3
bts asked May 29, 2018
1,879 views
Why is recursive equation of following code $T(n)=T(n/2)+O(1)$, not $T(n)=8*T(n/2)+O(1)$? int x=0; int A(n) { if(n==1) return 1; else { X+=8A(n/2)+n^3; } return X; }
3 votes
3 votes
1 answer
4
Ashish Sharma 3 asked Jun 16, 2017
1,776 views
What will be the time complexity for the following recurrence relation?$T(n) = 8\sqrt{n} T(\sqrt{n})+(log n)^{2}$According to me it is $\Theta (n(logn)^{3})$ . Please con...