(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) 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)
Where is c in that equation?
ReplyDelete