Complexity of dynamic programming algorithm for Knapsack
题
Dynamic programming algorithm for Knapsack is stated to have complexity $\mathcal O (nW)$.
However, I've also seen the complexity stated as $\mathcal O (n^2V)$, where $V=\max v_i$.
(Here $n$ is the number of items and $W$ the weight limit).
I see from the algorithm that the first complexity measure is correct: http://en.wikipedia.org/wiki/Knapsack_problem
Can someone tell me, why the other complexity measure works ?
没有正确的解决方案
不隶属于 cs.stackexchange