(Latest Revision: May 10, 2020)
[2020/05/10: fixed typo & minor rewording]
[2020/04/19: initial document]

Knapsack Problem



                            Weight Capacity ----->
obj
 #  wt val   |  0   1   2   3   4   5   6   7   8   9  10
_________________________________________________________
 0  0   0   |   0   0   0   0   0   0   0   0   0   0   0
 1  4   5   |   0   
 2  3   4   |   0   
 3  5   7   |   0   
 4  3   2   |   0
Let me know if you have questions about how such problems are solved. The algorithm is covered in section 6.4.

Directions For Submitting Solution:

Send an E-mail to
tester2@cs.csustan.edu
with this subject line:
CS 4440 Knapsack Problem
(Copy & Paste that exact subject line. Get it right, or get no credit.)

Here is a sample of the information I want in your e-mail. This shows what the information would be for a sample problem. You must give me the same kind of information for your assigned problem.
                   Total Weight ----->
obj
 #  wt val   |  0   1   2   3   4   5   6   7
_____________________________________________
 0  0   0   |   0*  0   0   0   0   0   0   0
 1  1   2   |   0*  2   2   2   2   2   2   2
 2  4   9   |   0   2   2   2   9* 11  11  11
 3  3   7   |   0   2   2   7   9  11  11  16*
 4  2   3   |   0   2   3   7   9  11  12  16*

Objects to use in optimal solution: 3 (wt=3;v=7), 2 (wt=4;v=9)
The sum of values of items 3 and 2 is 7+9=16, which is the last entry in the table, as it should be.
The sum of weights of items 3 and 2 is 3+4=7, which does not exceed the weight limit of 7.