3 ms·
One issue they mention is that you lose the simple greedy algorithm for making change. For example, for $0.38 it's better to give 2x$0.18 plus 2 pennies (4 coi
by maweaver 3y ago
One issue they mention is that you lose the simple greedy algorithm for making change. For example, for $0.38 it's better to give 2x$0.18 plus 2 pennies (4 coins), but many might intuitively give back a quarter, a dime, and 3 pennies (5 coins). Besides the added complexity, introducing a new coin solely to reduce the amount of change given is not effective if it is not used optimally.
- popularrecluse 3y ago2x$0.10 + 1x$0.18 is the preferred change.
- saulpw 3y agoAnd what algorithm did you use to find that? As per the comment you replied to, the greedy algorithm no longer works, and you have to exhaustively search through all possibilities of coins.
- couchand 3y agoNot the OP, but they appear to use the classic change-making algorithm "Dimes are Best". It works like this: give dimes for change, they're the best coin (highest value density).
- stevage 3y agoNot in the system where the 10c is replaced by the 18c.
- waveBidder 3y ago0.38 should actually just be 0.40, possibly 0.35 if the seller's generous. in physical transactions nobody pays 3.1415926 dollars for anything, even if the pricing algorithm says that's what you should charge. you just round to the nearest available coinage.