Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试解决这种重复,但我不知道如何展开它。
T(n)=2T((n+2)/3) + 1
我可以忽略那个“+2”并像 2T(n/3) + 1 一样解决它吗?
这来自一个使用V[a..b]数组并返回的问题:
V[a..b]
return V(X) + f(V, a, Y) + f(V, Z, b)
Y在哪里(2a+b)/3 and Z is (a+2b)/3
Y
(2a+b)/3 and Z is (a+2b)/3
所以:((b-a+3)/3) = ((n+2)/3)
((b-a+3)/3) = ((n+2)/3)
有点。这个技巧的严格版本是设置U(n) = T(n+1)和编写
U(n) = T(n+1)
U(n) = T(n+1) = 2T((n+1+2)/3) + 1 = 2T(n/3 + 1) + 1 = 2U(n/3) + 1.
然后求解U(例如,U(n) = O(n^log3(2))),然后您应该能够找到T相同阶的渐近表达式。
U
U(n) = O(n^log3(2))
T