T(n) = 2T(floor (n1/2)) +
log n is
(A) O(n log log log n)
(B) O(n log logn)
(C) O(log logn)
(D) O(logn log logn)
Answer D.
Master Method:
Master Method is a direct way to get the solution. The master method works only for following type of recurrences
Master Method is a direct way to get the solution. The master method works only for following type of recurrences
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) 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 T(n) = 2T(floor (n1/2))
+ n1/2
a=2, b=1, c=1/2 Then
bc=11/2< a. eq 3 follows
hence eq3. O(n log ba).
No comments:
Post a Comment
Note: only a member of this blog may post a comment.