PA of Algorithms Q49

0. Consider the following recurrence
T(n) = 2T([√n]) + 1,T(1) = 1
Which one of the following is true?

  • Option : B
  • Explanation :
    T(n) = 2T(√n) + 1
    Put n = 2k
    T(2k) = 2T(nk/2) + 1
    replace T(2k) by S(k)
    S(k) = 2 S(k/2) + 1
    Apply masters
    Klog22 ⇒ k > 1
    So Θ(k)
    Now we know n = 2k, k = log2(n)
    then Θ(logn)
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *