Академический Документы
Профессиональный Документы
Культура Документы
where v
i
is the value of the iAth 9ind of item.
1A1 9napsac9 problem
A similar dynamic programming solution for the -1 knapsack problem also runs in
pseudoApolynomial time. As above, assume are strictly positive
integers. >efine mHi,wI to be the maximum value that can be attained with weight less
than or e"ual to w using items up to i.
We can define mHi,wI recursively as follows: