Skip to content

Instantly share code, notes, and snippets.

@remiomosowon
Created July 3, 2014 21:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remiomosowon/386f517175f5dc3f5e54 to your computer and use it in GitHub Desktop.
Save remiomosowon/386f517175f5dc3f5e54 to your computer and use it in GitHub Desktop.
One-dimensional Knapsack Problem

Problem Statement

There are 5 boxes to be placed into a knapsack. The weights of the boxes are 12kg, 1kg, 4kg, 1kg, and 2kg. Their prices are $4, $2, $10, $1 and $2 respectively.

Which boxes should be chosen to maximise the amount of money while still keeping the overall weight under or equal to 15 kg?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment