(A) θ(log log n)
(B) θ(log n)
T(n) = 2T(√n) + 1 Let n = 2m ==> T(2m) = 2T(2m/2) + 1 Let S(m) = T(2m) ==> S(m/2) = T(2m/2) Thus above equation will be : S(m) = 2S(m/2) + 1 Applying master’s theorem S(m) = m Thus : T(n) = Θlog(n) (since n = 2m)
This question is duplicate of http://quiz.geeksforgeeks.org/algorithms-analysis-of-algorithms-question-17-2/
Quiz of this Question
Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.