简体   繁体   English

这个算法的上限是多少?

[英]What is a tight upper bound to this algorithm?

I implemented an algorithm to solve an NP-hard optimization problem. 我实现了一个算法来解决NP难的优化问题。 The complexity of this algorithm is O(sum (k = 1 to n) of k^n) . 该算法的复杂度是O(sum (k = 1 to n) of k^n) I know that O(n^(n+1) ) is a upper bound, but I do not know if it is a tight one. 我知道O(n^(n+1) )是一个上限,但我不知道它是否是一个紧。 Which is a tight upper bound to this algorithm: O(n^n) , O(n^(n+1)) or something else? 这个算法是一个紧密的上界: O(n^n)O(n^(n+1))还是其他什么?

Thanks 谢谢

The answer is O(sum k=1 n k n ) = O(n n ) . 答案是O(sum k=1 n k n ) = O(n n ) To verify that, note that the sum can, with error terms of cumulative size O(n n ) , be replaced by the parallel integral. 为了验证这一点,请注意,总和可以用累积大小O(n n )误差项替换为并行积分。 (The sum is the integral of a step function. Shade the differences between the step function and the continuous, then slide them over. Since the function is monotone increasing, the sum of those errors fits in the very last term.) Solve the definite integral and you wind up evaluating x n+1 /(n+1) at n and 1 . (总和是阶梯函数的积分。遮挡阶梯函数和连续函数之间的差异,然后将它们滑过。由于函数单调递增,这些误差的总和适合最后一项。)求解确定积分和你风评价x n+1 /(n+1)n1 That comes out to a O(n n ) term to go with your previous error term of the same size. 这是一个O(n n )项,与你以前的相同大小的误差项一致。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM