Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Knapsack Problem
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#! usr/bin/env python

#Given a set of items, each with a weight and a value
#determine the number of each item to include in a collection
#so that the total weight is less than or equal to a given limit and the total value is as large as possible.

l = [[4000, 20], [3500, 10], [1800, 9], [1000, 4], [400, 2], [200, 1]]
n = len(l)
m = []
Expand Down