Page 1 of 1

Help with Unbounded Knapsack

Posted: Wed Aug 04, 2010 2:29 am
by danielperaza
Hi! I have built an implementation of the unbounded knapsack algorithm by using dynamic programming. It is just a simple function that builds up the table of weights vs. profits like this one:

Code: Select all

[0, 0, 0, 7, 11, 12, 14, 18, 22, 23, 25]
That's fine. The problem is that I'm stuck trying to make the recursion backwards to find which objects were put into the knapsack by the algorithm.

Any ideas? does anyone have a code stub?

Re: Help with Unbounded Knapsack

Posted: Sun Sep 07, 2014 9:23 pm
by matheusdallrosa
if you save the best previous item of each item i think that in the and you will have the list, make some tests and reply.