Define as the minimum weight needed to achieve exactly value using items to . Here ranges from to , and ranges from to where .
Base cases:
(zero items, zero value, zero weight needed)
for (impossible to get positive value with no items)
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Value as index
Define as the minimum weight needed to achieve exactly value using items to . Here ranges from to , and ranges from to where .
Base cases:
(zero items, zero value, zero weight needed)
for (impossible to get positive value with no items)