in reply to Re^2: (Golf) Giving Change
in thread (Golf) Giving Change
If the coins are a little stranger, the greedy strategy will fail altogether. Maybe the land of Frobozz has 2-frob and 3-frob coins, but no 1-frob coin. You can make 7 frobs with one 3 and two 2s, but if you start out by giving two 3s, you're stuck.
We could define a "generalized penny" to be a coin which every other coin is a multiple of. The penny and the yen are both "pennies" by this definition. If such a coin exists, the greedy method will always produce an answer. There's no frob-penny in my example, though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: (Golf) Giving Change
by tadman (Prior) on Jun 12, 2001 at 05:26 UTC |