Monday 22 June 2015

Q63,p3,j14. The solution of the recurrence relation of T(n) = 3T(floor(n/4)+ n is



(A) O(n2)
 (B) O(nlg n)
(C) O(n)
 (D) O(lg n)
Answer C.

Explanation.
T(n) = aT(n/b) + f(n) 
highest degree of f(n) is c.
There are following three cases:
T(n)= O(nc) where a<
bc                       eq 1.
T(n)= O(nc log n) where bc=a. eq 2.
T(n)=O(nlogba) where a> bc.

In our case  a=3,b=4,c=1.
3<4
Eq 1 follows hence    O(nc)=O(n)

1 comment:

Note: only a member of this blog may post a comment.