📜  门| GATE-CS-2017(套装2)|第 56 题

📅  最后修改于: 2021-09-25 07:30:19             🧑  作者: Mango

Gate_4

(A) θ(log log n)
(B) θ(log n)
(C) θ(sqrt(n))
(D) θ(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)

此问题与 https://www.geeksforgeeks.org/algorithms-analysis-of-algorithms-question-17-2/ 重复
这个问题的测验