Hacker News new | ask | show | jobs
by jwegan 5533 days ago
Technically the sort algorithm from the article is called counting sort, not radix sort. While both radix sort and counting sort are O(n) they are fundamentally different algorithms. In practice radix sort can be used for larger domains of values than is feasible with counting sort. Furthermore care must be taken if you want a stable sort since only certain variants of radix sort are stable.
1 comments

What the grandmother did with ages, say, 0-99, would be radix sort if the sorter had 100 pockets. Then the sort was done in just one pass. I don't recall counting sort, but in this case it sounds like the same thing.

The obvious way to implement radix sort, just think punch cards, is stable with no extra effort.