How can I unfold the recurrence: T(n)=2T((n+2)/3)

后端 未结 1 722
攒了一身酷
攒了一身酷 2021-01-25 10:28

I\'m trying to solve this recurrence, but I don\'t know how to unfold it.

T(n)=2T((n+2)/3) + 1

Can I ignore that \"+2\" and solve it as it was

相关标签:
1条回答
  • 2021-01-25 10:57

    Sort of. The rigorous version of this trick is to set U(n) = T(n+1) and write

    U(n) = T(n+1)
         = 2T((n+1+2)/3) + 1
         = 2T(n/3 + 1) + 1
         = 2U(n/3) + 1.
    

    Then solve for U (e.g., U(n) = O(n^log3(2))) and then you should be able to find an asymptotic expression for T of the same order.

    0 讨论(0)
提交回复
热议问题