Also called Zero-one knapsack problem and Knapsack, by dynamic programming.
fresh numbers
The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from 0/1 knapsack's own run on the numbers shown.
choose one
1question 1
How many cells does the method fill for 4 items, 1 32, 7 47, 7 97, 5 43, each weight then value, in a bag that holds 6?
the answer, and why
the answer is B
4 rows of 6 cells, a row for each item and a cell for each room from 1 to 6. The first row and column are written at the start.
if you chose another
AThat counts the first row and column too, which are written at the start, not filled.
CThat adds the items and the room, but each row fills a cell for each room.
DThat counts room 0 too, which is written at the start.