Input: A sequence of weights and another of values, the capacity of knapsack.
Output: Maximum value. (You can cut item into pieces.)
Sorted by of each item, always choose the biggest one in that moment.
Since every unit of space in the knapsack contains the most valued item,
you cannot increase total value by changing items.
Furthermore, there's no space left in the knapsack. It's the best choice apparently.
Input: A sequence of weights and another of values, the capacity of knapsack.
Output: Maximum value. (But cannot split the items.)
Time complexity: , where is the number of items.
Since there are subsets, and each validation takes times.
the answer when only consider the first items, and the weight is exactly .
Input: A sequence of weights and another of values, the capacity of knapsack.
Output: Maximum value. (items can be taken infinite times.)
the answer when only consider the first items, and the weight is exactly .
the answer when only consider the first items, and the weight is exactly .
Input: A sequence of weights and another of values, the capacity of knapsack.
Output: Maximum value. (items can be taken certain number times.)
the answer when only consider the first items, and the weight is exactly .
We can split items into groups of , groups in total.
And use these groups to simplify bounded knapsack into 0/1 knapsack.