6 6 votes $T(n) = 2T(\sqrt{n}) + n$ Algorithms algorithms time-complexity recurrence-relation + – Shubhanshu 2.5k views answer comment Share Follow Print See all 14 Comments 14 14 Comments reply Akshay Koli 4 commented Jan 20, 2018 reply Follow flag you can refer this link :-https://www.quora.com/What-is-the-complexity-of-recurrence-relation-T-n-2T-root-n-+n 1 1 replyShare Shubhanshu commented Jan 20, 2018 reply Follow flag Thanks, @Akshay Koli 4 I solved it using the same as mentioned in Quora, but I want to know the steps, using substitution method as this method doesn't apply to every question. 0 0 replyShare sumit goyal 1 commented Jan 20, 2018 reply Follow flag @Shubhanshu do you also used master theorem ?? vivek verma applied master theorem , but i dont think it can be applied 0 0 replyShare Shubhanshu commented Jan 20, 2018 reply Follow flag What he did is correct. 0 0 replyShare sumit goyal 1 commented Jan 20, 2018 reply Follow flag @Shubhanshu can you expllain it why , it will be helpful iam stuck in question , thanks in advance 0 0 replyShare Shubhanshu commented Jan 20, 2018 reply Follow flag Step 1) Take $n = 2^k$ You will get modified equation as $T(2^k) = 2T(2^{k/2}) + 2^k$.....(iii) Step 2) $T(2^k) = S(k)$ ...... (i) and put k = k/2. You will get $T(2^{k/2}) = S(k/2)$ .....(ii) Now from (i) and (ii) modified equation is:- $S(k) = 2S(k/2) + 2^k$ Use Master's theorem now, it will be easy. 0 0 replyShare hacker16 commented Jan 20, 2018 reply Follow flag https://gateoverflow.in/197417/please-solve-this-q 0 0 replyShare Shubhanshu commented Jan 20, 2018 reply Follow flag @hacker16 I know it is easy to solve it by the method in your answer, but do you know how to solve this question without that way? 0 0 replyShare sumit goyal 1 commented Jan 20, 2018 reply Follow flag answer is wrong there , answer is $\Theta (n)$ @hacker16 0 0 replyShare sumit goyal 1 commented Jan 20, 2018 reply Follow flag T(n) = aT$(\frac{n}{b}) + \Theta (n^k log^{p} n)$ so in equation we have $2^k$ or let say $2^n$ its not $n^2$ so we cannot apply masters ?? correct me if iam wrong Shubhanshu 1 1 replyShare hacker16 commented Jan 20, 2018 reply Follow flag may be this might help https://gateoverflow.in/841/gate2002-2-11 0 0 replyShare Shubhanshu commented Jan 20, 2018 reply Follow flag @sumit goyal 1 f(k) which is 2^k (exponential function) is bigger than 2S(k/2). Hence, it will be the TC. or TC = O(2^k) or O(n) as 2^k = n. 0 0 replyShare sumit goyal 1 commented Jan 20, 2018 reply Follow flag T(n) = $8T(\frac{n}{2})+ n^2$ answer = $\Theta (n^3)$ if i apply that logic here that n$^2$ >> T$(\frac{n}{2})$ = O($(n^2)$ it failed here not a good approach @Shubhanshu according to me bro 1 1 replyShare sushmita commented Oct 5, 2018 reply Follow flag did u get the explanation here ? 0 0 replyShare Please log in or register to add a comment.
Best answer 2 2 votes it should be o(n) abhishekmehta4u answered Mar 10, 2018 • selected Feb 1, 2019 by Shubhanshu abhishekmehta4u comment Share Follow 0 reply Please log in or register to add a comment.