0/1 knapsack
Level 2 of 3
Also called Zero-one knapsack problem and Knapsack, by dynamic programming.
Packs a bag that holds only so much weight with the most value it can carry, each item taken whole or left behind. Taking the most valuable first is not always best, so a table holds the best for every start of the items and every room up to the bag's.
the most value: the items down the side, the room along the top
- cells filled
- 0
step 1 of 1
Examples