5 votes 5 votes Algorithms algorithms time-complexity recurrence-relation + – jaig asked Nov 1, 2017 jaig 558 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply sourav. commented Nov 1, 2017 reply Follow Share Is answer $O(\log n)$ or $O(n^4)$? 0 votes 0 votes jaig commented Nov 1, 2017 reply Follow Share answer is $\Theta (log n)$ 0 votes 0 votes Please log in or register to add a comment.
Best answer 8 votes 8 votes T(1) = Θ(1) corrosponding to A(1) T(n) = T(n/2) + Θ(1) corrosponding to A(n) = 8A(n/2) + n3 .Statement; takes Θ(1) This is Case 2 of Master Theorem Therefore T(n) = Θ(log n). Shivam Chauhan answered Nov 1, 2017 • selected Nov 1, 2017 by Shivam Chauhan Shivam Chauhan comment Share Follow See all 4 Comments See all 4 4 Comments reply jaig commented Nov 1, 2017 reply Follow Share Sir what is the difference between calling recursively and assigning value to a variable. And how this T(n) is derived from A(n) can u please explain. 0 votes 0 votes Shivam Chauhan commented Nov 1, 2017 reply Follow Share T(n) is the time taken by above program to execute. A(n) is the value that program outputs. To caluculate A(n) we need to refer to A(n/2) To caluculate A(n/2) we need to refer to A(n/4) .. . and this goes till we reach n=1 n to n/2 to n/4 ....1 takes log2n steps 0 votes 0 votes Aashish S commented Nov 6, 2017 reply Follow Share Can u pls elaborate Case 2 of Master Theorem in detail in context with A(n) = 8A(n/2) + n3 0 votes 0 votes Nancy Pareta commented Sep 12, 2018 reply Follow Share else { b=A(n/2)-------------T(n/2) c=8*b-----------------O(1) d=c+n^3-----------------O(1) return d } T(n)= T(n/2) + Θ(1) case 2 of master theorem T(n) = Θ(log n). points to be remember while doing this :- 1) check if it is function call or not 2) for function call there must be code 0 votes 0 votes Please log in or register to add a comment.