Math θ符号中的(3+;9+;27+;…+;3^n)是什么?
直觉上,我认为它简化为θ(3^n)Math θ符号中的(3+;9+;27+;…+;3^n)是什么?,math,runtime,analysis,Math,Runtime,Analysis,直觉上,我认为它简化为θ(3^n) 但我不确定,因为我无法说服自己,从3^0到3^(n-1)的一切都不重要。尽管查找程序的时间复杂性是。但它更具有数学性。您应该避免询问StackOverflow。您可以在math.stackexchange上询问 这只是求几何级数的和,我们需要求n项的和 s(n) = a1(1-r^n)/(1-r) where r=common ratio and a1 is first term. s(n) = 3(1-3^n)(1-3) = (3-3^(n+
但我不确定,因为我无法说服自己,从3^0到3^(n-1)的一切都不重要。尽管查找程序的时间复杂性是。但它更具有数学性。您应该避免询问StackOverflow。您可以在
math.stackexchange
上询问
这只是求几何级数的和,我们需要求n项的和
s(n) = a1(1-r^n)/(1-r) where r=common ratio and a1 is first term.
s(n) = 3(1-3^n)(1-3)
= (3-3^(n+1))/-2
= (3^(n+1)-3)/2
= (3^n+1)/2 (appox)
= 3^n+1 (appox)
= O(3^n) (appox)
因此你可以说时间复杂度是θ(3^n) 我投票结束这个问题,因为它不是一个编程问题。它更适合做数学题。非主题您要求的是
总和(3^i,i=0…N)
。(它是O(3^n)
与O(exp(n))
..)您好,感谢您提供的详细解决方案。我会记下数学。stackexchange for the future:黛雅,你真好,谢谢。如果答案解决了您的问题,您可以选择答案。