[英]In Big-O terms if O(n-1) is the same thing as O(n) then why in the master theorem is T(n-1) not equal T(n)?
[英]Master Theorem and substitution method on (n-1)
我應該使用哪種方法來解決這種復發?
T(n)= { Θ(1) if n = 1
{ T(n-1) + Θ(n) if n > 1
您可以使用迭代方法解決此問題。 作為提示,它求解為Θ(n 2 )。
希望這可以幫助!
使用主方法,我們可以發現:
a = 1,b = 1,d = 1,則a = b ^ d。
因此T(n)=(級別數)*(每個級別的工作)= n * n
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.