Created
August 9, 2018 02:25
-
-
Save kangeugine/47a308470ef215714b860dafcafd677b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example | |
val = [60, 100, 120, 120] | |
wt = [10, 20, 30, 20] | |
W = 50 | |
n = len(val) | |
K = knapSack(W, wt, val, n) | |
ix = knapSackIndex(W, wt, val, n ,K) | |
print("Max value:{}, with items:{}".format(K[-1][-1], str(ix))) | |
# Max value:280, with items:[3, 1, 0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment