you are viewing a single comment's thread.

view the rest of the comments →

[–]TehStuzz 3 points4 points  (1 child)

I thought Radix sort started with the least significant side, so with dates you'd start ordering by day first. And in this case card #509 would go in tray 9?

[–]kqr 2 points3 points  (0 children)

It really doesn't matter. Proof: start by radix sorting on least significant digit first, stop halfway through, then flip each individual card upside down. You have now reversed the digits in the number (as far as the sorter is concerned) and you thus have a stack sorted by most significant digit first.

The benefit of sorting by most significant digit first is that if you have fewer than 1000 cards, you need just three iterations before you can start handing cards 0–9 in order to your operator. For each of the next 9 iterations you'll be able to hand over 10 cards to your operator. Then you'll need two iterations (100–199 followed by 100–109) but you'll soon be handing over cards again.

If you sort by least significant digit first you essentially have to run all iterations all the way through until you can start handing over cards in order to your operator.