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?