Quantcast
Channel: The Old New Thing
Viewing all articles
Browse latest Browse all 24428

re: A single-handed effort to keep the memory of $2 bills alive

$
0
0

@Maurits: You're lucky then, that the US coin selection is "perfect" for making change. The greedy algorithm (pay the largest value coin less than the running total) will always result in getting the right amount with the fewest coins.

This is not always the case with the rest of the world. For particularly for pathological coin values (1 Galleons = 17 Sickles = 493 Knuts being the best known) you can end up having to do backtracking / alternate strategies just to make "optimal" change. I believe its NP hard, in general...


Viewing all articles
Browse latest Browse all 24428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>