简体   繁体   中英

What is a tight upper bound to this algorithm?

I implemented an algorithm to solve an NP-hard optimization problem. The complexity of this algorithm is 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. Which is a tight upper bound to this algorithm: O(n^n) , O(n^(n+1)) or something else?

Thanks

The answer is 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. (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 . That comes out to a O(n n ) term to go with your previous error term of the same size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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