homework?
I'm not totally familiar with the knapsack problem, but from googling a bit it sounds like you're headed for some recursion.
you're going to have to explain the problem a little better, as far as i can tell you have a sack that can hold an unspecified amount of items. each item may come in stacks of an unspecified number of identical "brother" items? each item has a size and weight right?
the sack has a limit as to how much volume but not weight right? and you are trying to get the sack to weigh as much as possible?
the questions i have for you are:
what are your constraints? are there a specified number of items to work with or is it 0 to N number of items, each weighing 0 to N lbs and having a volume with 0 to N? I'm afraid without this info it would be pointless to continue.
I assume you will supply a two dimensional array or even better, an array of a class or struct you build. something with the given items to work with? one dimension holding the weight of the object, the other holding the volume of the object. and you will also supply the max volume of the sack(N).
what you would want to do in this situation is a recursive algorithm trying different combinations and find out which combination returns the largest weight.
will be a somewhat processor demanding algorithm but will get you your answer.
feel free to post whatever code you got and I(or we) will try to give you a hand. I'm not gonna do your homework for you
