retagged by
402 views
0 votes
0 votes

Is the given answer correct?

retagged by

2 Answers

1 votes
1 votes

The answer should be logn .   My previous approach was wrong......The correct recursive equation would be T(n) = T(N/2) + O(1) . and it gives log(n) Time Complexity.

edited by
1 votes
1 votes

THESE KIND OF PROBLEMS HAVE A DIFFERENT APPROACH--->

LET B = A(N/2) --------------T(N/2) 

      C= 4 * B  ----------------O(1)

      D= N2 --------------O(1)

    E= C+D------------------O(1)

    M= X+ E ---------------O(1)

SO OVERALL TIME COMPLEXITY = T(N/2) + C (constant)

                                                         =O(logn) answer.

this is how it will be done and this is the correct approach.

Answer:

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
1 answer
2
rajan asked Dec 9, 2016
367 views
how to solve these two using matser thorem.1. t(n)=2t(√n)+n2. t(n)=4t(√n)+(logn)^2
1 votes
1 votes
2 answers
3
vijaycs asked Jul 11, 2016
1,887 views
On which of the following recurrence relation Masters theorem can not be applied ?A. T(n)= 2T(n/2) + n (log n).B. T(n) = T(n/2) + 1.C. T(n) = 8T(n/2) + (log n).D. T(n) = ...
0 votes
0 votes
2 answers
4