January 2020
Intermediate to advanced
346 pages
9h 8m
English
The Rosetta Code website (rosettacode.org) provides a collection of programming tasks, each with contributed solutions in numerous languages. One of these tasks, described at rosettacode.org/wiki/Knapsack_problem/0-1, is a knapsack 0-1 problem where a tourist needs to decide which items to pack for his weekend trip. The tourist has 22 items he can choose from; each item was assigned by the tourist with some value that represents its relative importance for the upcoming journey.
The weight capacity of the tourist's bag in this problem is 400, and the list of items, along with their associated values and weights, is as follows:
|
Item |
Weight |
Value |
|
map |
9 |
150 |
|
compass |
13 |
35 |
|
water ... |
Read now
Unlock full access