- Category:
- Console
- Tags:
-
[Java]
[源码]
- File Size:
- 2kb
- Update:
- 2013-11-28
- Downloads:
- 0 Times
- Uploaded by:
Description: The knapsack problem algorithm design and analysis. First, the optimal solution in the first row and first column of the matrix are assigned 0 then from top to bottom, computing m [i] [j] values from left to right, if the weight is greater than the i-th item j values, i.e., the i-th item is not put into the backpack, then m [i] [j] assigned to m [i-1] [j], otherwise, it is the i-th item is not put into the resultant bags and backpacks the maximum value finally calculate the optimal solution from the previous value of the vector, if m [i] [j] = m [i-1] [j], then the x [i] values 0, otherwise x [i] value of 1, the i-th and j minus the weight of the article.
To Search:
File list (Check if you may need any files):
Knapsack.java