(A) T(n) = O(n)
(B) T(n) =
O(log2n)
(C) T(n) = O(n)
(D) T(n) = O(n2)
Answer(A)
Explanation .
Let T(1)=1
T(2)= 2T(1)+21/2= 2+1.141.
T(4)=2T(2)+2.= 2(3.1)+2= 8.2
T(8)=2(8.2)+81/2=18.
Hence it is multiple of n so O(n).
No comments:
Post a Comment
Note: only a member of this blog may post a comment.