Knapsack Problem Without Value

Gary Herron gherron at
Fri Dec 13 03:49:14 CET 2013

On 12/12/2013 06:08 PM, geezle86 at wrote:
> Hi,
> I wanna ask about Knapsack. I do understand what Knapsack is about. But this one i faced is a different problem. There is no value. I mean, it's like this, for example.
> I have 4 beams [X0, X1, X2, X3]. Each 1, 2, 2, 3 cm long. I want to make a new 6 cm long connected-beam from these 4 beams. I can make it from some of these. The output will print:
> 1, 2, 3 #(X0, X1, X3)
> You understand what my problem is? Can you help me?
> Sincerely,

No, I don't understand what your problem is.

You say there are no values but then you give 4 values (1, 2, 2, and 3), 
and then you *solve* the Knapsack problem like this:
         1, 2, 3 #(X0, X1, X3)

That looks like a fine solution to me.


  * Exactly *what* is the problem.  If you tell us *carefully* what the
    problem is, we may try to solve it.

  * This is a Python list.  Does your problem have anything to do with

  * Is this a homework problem?  We generally don't solve homework
    problems here (since you don't learn anything that way), but we are
    certainly happy to help you learn.

Gary Herron

Dr. Gary Herron
Department of Computer Science
DigiPen Institute of Technology
(425) 895-4418

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list