Raul Miller wrote:
> Background: http://xkcd.com/c287.html
> (That's not really an np-complete problem, near as I can tell.)
>
It's an integer knapsack problem if you convert everything to cents.

Given a maximum weight W and n objects with integer weights, you can solve
this by dynamic programming in time O(nW).  See

http://cgm.cs.mcgill.ca/~msuder/courses/360/lectures/integer-knapsack.html

Best wishes,

John

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to