📜  门| GATE-CS-2017(Set 2)|第56章

📅  最后修改于: 2021-06-28 22:41:15             🧑  作者: Mango

Gate_4

(A) θ(对数log n)
(B) θ(log n)
(C) θ(平方(n))
(D) θ(n)答案: (B)
解释:

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)

这个问题是http://quiz.geeksforgeeks.org/algorithms-analysis-of-algorithms-question-17-2/的副本
这个问题的测验