Jason House wrote:
Don't get offended, he didn't respond to anyone else's algorithm either.
I just wanted to bring what I think is an interesting problem to the table; my response shouldn't be used as a yardstick for one's ability to define a good algorithm.
Now that I feel pressured to give an answer, I'd say that BCS's answer is right on the money. It's the exact algorithm I put in std.algorithm (not checked in yet), and it works leanly and meanly on a large data set as we speak. Sean's, bearophile's, and your answers were also very close to BCS's, just that yours was a tad less detailed and the others came a bit later.
Andrei
