An alternative divide-and-conquer sorting algorithm
that can better adapt to integers
with truly random bits is so-called radix-exchange sorting
(see e.g. [33]).
An implementation that handles small sub-arrays
differently to improve performance is shown below,
where we assume that
.
The static initializer show below can be used to initialize array BIT:
An array of positive 32-bit integers (with a zero most significant bit), for example, can be sorted by calling radixsort() with b = 30. Because the two recursive method invocations can be done in parallel, radixsort() is a parallel 2-way recursive method, and implicit parallelism can be made explicit using the method discussed in this paper.
In figure 25, we show the serial and parallel execution time of radix-exchange/insertion sorting when applied to the absolute values of the same random integer arrays used for quick/insertion sorting. Although serial radix-exchange/insertion sorting is more expensive than serial quick/insertion sorting, the parallel versions perform better for these random integer arrays, because the method invocation trees are more balanced.
Figure 25: Radix-Exchange/Insertion Sorting of Random Integer Arrays