Search code examples
hexradix-sortradix

Radix in hexadecimal


Pierre Terdiman in his article "Radix Sort Revisited" tells us:

For example you’ll need 4 passes to sort standard 32 bits integers, since in hexadecimal the radix is a byte.

But 0xAB has two radices, namely A and B, 4-bit wide either.

So, what is the radix in hexadecimal? Because i can't understand the article.


Solution

  • From what I understand, the 0xAB was just an example to what radix is. When approaching Radix sort, it's easier to use bytes (no need for shifting - only casting, in C/C++, anyway).

    The last part of the sentence is the important thing here:

    since in hexadecimal the radix is a byte

    After saying that, it doesn't matter what was said earlier...

    Just to strengthen the argument, examine his example - the SortedBuffer initialization uses byte as radix (256*sizeof(int)), not nibble:

    memset(SortedBuffer, -1, 256*sizeof(int));   // Fill with –1
    

    (again, from I understand in this article...)