laziness, impatience, and hubris | |
PerlMonks |
Re: Re: (Golf) Giving Changeby ZZamboni (Curate) |
on Jun 12, 2001 at 04:23 UTC ( [id://87690]=note: print w/replies, xml ) | Need Help?? |
No, it does not correspond to the 0-1 Knapsack problem
(which is NP-complete), but to the
fractional
knapsack problem, which can be solved using a greedy algorithm
(put as many of the largest denomination as will fit, then continue
to the next lower denomination, and so on until you reach the
target amount).
--ZZamboni
In Section
Meditations
|
|