P is for Practical PerlMonks

### Re^2: How can I calculate the right combination of postage stamps?

by JavaFan (Canon)
 on Oct 26, 2010 at 10:24 UTC ( #867433=note: print w/replies, xml ) Need Help??

In practice, any coin issuing entity will make coins in such a way that a greedy algorithm is optimal. That is, noone is issuing coins as 7c, 6c and 1c coins (a case where greedy isn't optimal to make 24c change (greedy gives you 3 x 7c + 3 x 1c, while optimal is 4 x 6c)). Instead typical coin denominations are 1c, (2c), 5c, 10c, 20 or 25c, (50c), 100c, (200 or 250c), (500c). For instance, US dollar coins come in 1c, 5c, 10c, 25c, 50c, and 100c; Euro coins in 1c, 2c, 5c, 10c, 20c, 50c, 100c, and 200c; Yen coins in 1y, 5y, 10y, 50y, 100y, 500y; Pound Sterling coins in 1p, 2p, 5p, 10p, 20p, 50p, 100p, 200p (effectively the same as Euro coins). For all, a greedy algorithm is optimal.
• Comment on Re^2: How can I calculate the right combination of postage stamps?

Replies are listed 'Best First'.
Re^3: How can I calculate the right combination of postage stamps?
by LanX (Chancellor) on Oct 26, 2010 at 13:20 UTC
True for coins, but postage stamps can be very different.

Cheers Rolf

Create A New User
Node Status?
node history
Node Type: note [id://867433]
help
Chatterbox?
 [LanX]: YT=youtube [Discipulus]: ;=) yes i'm not SO dumb [LanX]: SO=StackOverflow [Discipulus]: :=( [perldigious]: I watched some video on YT awhile back with auto-subtitle on and the speaker had a very thick cockney sort of English accent... hillarity ensued in the subtitles. [Discipulus]: IHAA=I hate acronyms anyway LanX LOLs

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2017-06-23 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (552 votes). Check out past polls.