Written in Java. Uncomment the code between the horizontal dotted lines for corresponding solutions in Java file. Cap variable gives the capacity of the kanpsack Change the no_objects variable to ...
return Math.max(val[n - 1] + knapSack(W - wt[n - 1], wt, val, n - 1),knapSack(W, wt, val, n - 1)); return knapSack(W, wt, val, n - 1); ...