Knapsack Problem

I was challenged by my father to write a program that would give all the possible combinations from a set of numbers to add to a certain amount. This is actually called the subset sum (or knapsack) problem and I was going to need to do some research.

Eventually I came up with a good solution using a binary counter as on/off switches for each number of the set..

You can watch a simple demo run of the program here:

Leave a Reply

Your email address will not be published. Required fields are marked *