The bottom-right DP cell answers the original optimization problem. It uses every item and the full capacity. This lesson reads that cell as the exact maximum achievable value while keeping clear that the subset itself still needs to be reconstructed.

highlighted = computed this step

Final cell

The final cell is dp at all items and full capacity, with value 9. Why: that state is exactly the original problem, not a helper problem. All earlier cells restrict either the item prefix or the available capacity, but this cell removes both restrictions and asks for the best value the instance can achieve.

dp[4,7]=9dp[4,7]=9
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)

Maximum value

No feasible subset can exceed value 9. Why: the recurrence has already compared every take-or-leave decision for every prefix and capacity on the way to this state. The number is therefore an optimum certificate for value, even before the traceback tells us which items achieve it.

optimal value 9\text{optimal value }9
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)

Diagram note

The highlighted cell is recomputed from the same DP table as every other entry. It is useful to separate what the table proves from what it has not yet named: the table proves the optimal value, and traceback will recover the subset. The computation is exact for this zero-one integer instance and pseudo-polynomial in the capacity magnitude. Pixel positions are rounded for layout; every number shown is exact.

bottom-right cell is the optimum value\text{bottom-right cell is the optimum value}
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)