0 votes 0 votes Algorithms master-theorem recurrence-relation time-complexity made-easy-test-series + – akash.dinkar12 asked Nov 4, 2017 • retagged Jan 10 by Hira Thakur akash.dinkar12 902 views answer comment Share Follow See all 4 Comments See all 4 4 Comments reply Ashwani Kumar 2 commented Nov 4, 2017 reply Follow Share c) O(n) ?? 0 votes 0 votes Rishabh Gupta 2 commented Nov 4, 2017 reply Follow Share Master method can't be applied here. Right?? 0 votes 0 votes Ashwani Kumar 2 commented Nov 4, 2017 reply Follow Share @Rishab we can substitute $n=2{^m}$ and can proceed further 0 votes 0 votes Rishabh Gupta 2 commented Nov 5, 2017 reply Follow Share @Ashwani Oh! Yes 0 votes 0 votes Please log in or register to add a comment.
Best answer 2 votes 2 votes Given $T(n)=2T(\sqrt n) + n$ Substitute $n=2{^m}$, we get $T(2^{m})=2T(2^{m/2}) +2^{m}$ We can write a new recurrence relation as $S(m)=2S(m/2) +2^{m}$ $S(m)=\Theta (2^{m})$ $T(n)=\Theta (n)$ Hence option c) is correct Ashwani Kumar 2 answered Nov 4, 2017 • selected Nov 17, 2017 by akash.dinkar12 Ashwani Kumar 2 comment Share Follow See 1 comment See all 1 1 comment reply charul commented Nov 22, 2017 reply Follow Share how did you proceed from line 5 to 6 in your answer? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes put n=2^m T(2^m)=T(2^(m/2))+2^m T(2^m)=S(m) S(m)=S(m/2)+2^m use master theorem m^(log2)=m 2^m=w(m) so , S(m)=2^m T(2^m)=2^m T(n)=n sachin! answered Nov 4, 2017 sachin! comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes O(n) neelesh bhakt answered Nov 17, 2017 neelesh bhakt comment Share Follow See 1 comment See all 1 1 comment reply charul commented Nov 17, 2017 reply Follow Share did you consider 2^m as constant, if yes then why? Please explain 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes substitute n = 2m Then apply master's theorem. you'll get O(n). Ashwin Kulkarni answered Nov 17, 2017 Ashwin Kulkarni comment Share Follow See all 3 Comments See all 3 3 Comments reply charul commented Nov 17, 2017 reply Follow Share @Ashwin Kulkarni , after substituting we get f(m) = 2*f(m/2)+2^m, so do we have to take 2^m as constant? 0 votes 0 votes Chirag arora commented Nov 19, 2017 reply Follow Share We are not considering 2^m as constant... Actually when T(2^m)=s(m) So , T(2^m/2) + 2^m becomes S(m)=S(m/2) + m ...... 0 votes 0 votes Sona Barman commented Jan 7, 2018 i edited by Sona Barman Jan 7, 2018 reply Follow Share I think answer is not O(n).After reading similar type of question and answer we are assuming that answer will be this.I this is case of change variable.we have to solve properly taking substitution rather guessing answer.Otherwise confusion will not be clear.If possible please solve. Before applying Master theorem we should be careful whether it is applicable to particular problem or not. 0 votes 0 votes Please log in or register to add a comment.