Also called 0/1 knapsack, memoised and Top-down 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 knapsack from the top down's own run on the numbers shown.
choose one
1question 1
Items, each written weight then value, then what the bag holds after the semicolon: 2 30, 1 20, 3 40; 6. How many cells does the method work out?
the answer, and why
the answer is B
C at 6 asks B at 6 and 3. Each asks A at two rooms, 6 and 5, then 3 and 2. 1 + 2 + 4 cells.
if you chose another
AThat is the table, 3 rows of 6. This method asks only for the cells it needs.
CThat counts the calls, the first and two for each cell.
DThat is the fewest, one cell a row, which comes only when the second and third items each weigh as much as the bag or more.