Created
August 9, 2018 02:25
-
-
Save kangeugine/47a308470ef215714b860dafcafd677b to your computer and use it in GitHub Desktop.
Revisions
-
kangeugine created this gist
Aug 9, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ # 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]