Reccurrence T(n) = T(n^(1/2)) + 1

后端 未结 2 1367
耶瑟儿~
耶瑟儿~ 2020-12-09 21:21

I\'ve been looking at this reccurrence and wanted to check if I was taking the right approach.

T(n) = T(n^(1/2)) + 1
= T(n^(1/4)) + 1 + 1
= T(n^(1/8)) + 1 +          


        
2条回答
  •  臣服心动
    2020-12-09 22:26

    hint: assume n = 22m or m = log2log2n, and you know 22m-1 * 22m-1 = 22m so, if you define S(m)=T(n) your S will be:

    S(m) = S(m-1)+1 → S(m) = Θ(m) → S(m)=T(n) = Θ(log2log2n)

    extend it for the general case.

    In recursion like T(n) = T(n/2) + 1, in each iteration, we reduce the height of the tree to half. This leads to Θ(logn). In this case, however, we divide the input number by a power of two (not by two) so it turns out to be Θ(log log n ).

提交回复
热议问题