"Dann Corbit" <DCorbit@connx.com> writes:
> Radix sort can also be made completely generic by using a callback
> function.
> The function gives back n-bits at a time, from the most significant bits
> to the least significant.
That's mighty handwavy --- it assumes that the datatype permits a simple
breakdown into small pieces that can be sorted lexicographically. Seems
to me that's a much stronger requirement than assuming that you can tell
which of two whole values is smaller. What's worse, it needs to be the
same number of pieces for every value, which makes it hard to deal with
variable-length data.
> So, for char string, and a radix of 256, you just return the first char,
> then the second char, etc. to get the classical radix sort.
Uh, no, you'd need to work right-to-left, after having padded all the
strings to the same length somehow.
regards, tom lane