Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

need an alogrithm

Name: Anonymous 2010-01-08 0:52

Any number of people each with their own
specific number of gold coins.

I need to distribute some random number of
gold coins to these people in the most even
fashion starting with the poorest.

One way to do this would be to sort an array
assuming 2 element {(person, gold),...} by the
gold (array = dictionary in python) give a coin
to the first element (assume sort from low to
high), and repeat this until all coins have
been given out.

It seems stupid to sort each time I give a coin.

Help me with a more efficient way?

Please in python or pseudocode or english.

Name: Mbt 2010-04-26 23:28

The Mbt with different variety color and designs, Mbt shoes give you a better posture and a more effective gait, The Mbt sale Now! Free Shipping! NO Tax! http://www.mbt-antishoes.net

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List