Fast exchange sorts
We present three variations of the following new sorting theme: Throughout the sort, the array is maintained in piles of sorted elements. At each step, the piles are split into two parts, so that the elements of the left piles are smaller than (or equal to) the elements of the right piles. Then, the two parts are each sorted, recursively. The theme, then, is a combination of Hoare's Quicksort idea, and the Pick algorithm, by Blum, et al., for linear selection. The variations arise from the possible choices of splitting method.
Two variations attempt to minimize the average number of comparisons. The better of these has an average performance of 1.075nlgn comparisons. The third variation sacrifices the average case for a worst-case performance of 1.756nlgn, which is better than Heapsort. They all require minimal extra space and about as many data moves as comparisons.
KeywordsAverage Case Average Cost Sorting Method Sorting Scheme Pivot Element
Unable to display preview. Download preview PDF.
- [BIFP73]Blum, M., R. W. Floyd, V. Pratt, R. L. Rivest, and R. E. Tarjan, “Time Bounds for Selection,” Journal of Computer and System Sciences, (1973), Vol. 7, pp. 448–461.Google Scholar
- [Brow76]Brown, T., “Remarks on Algorithm 489,” Trans. on Mathematical Software, (1976), Vol. 3, No. 2, pp. 301–304.Google Scholar
- [Floy64]Floyd, R. W., “Algorithm 245 (Treesort3),” Comm. of ACM, (1964), Vol. 7, No. 12, p. 701.Google Scholar
- [FlRi75a]Floyd, R. W., and R. L. Rivest, “Expected Time Bounds for Selection,” Comm. of ACM, (1975), Vol. 18, No. 3, pp. 165–172.Google Scholar
- [FlRi75b]Floyd, R. W., and R. L. Rivest, “Algorithm 489 (The Algorithm SELECT — for Finding the i-th Smallest of n Elements),” Comm. of ACM, (1975), Vol. 18, No. 3, p. 173.Google Scholar
- [FrMc70]Frazer, W. D. and A. C. McKellar, “Samplesort: A Sampling Approach to Minimal Tree Sorting,” Journal of ACM, (1970), Vol. 17, No. 3, pp. 496–507.Google Scholar
- [Hoar61]Hoare, C. A. R., “Algorithm 63 (Partition); 64 (Quicksort); 65 (Find),” Comm. of ACM, (1961), Vol. 4, No. 7, pp. 321–322.Google Scholar
- [Hoar62]Hoare, C. A. R., “Quicksort,” Computer Journal, (1962), Vol. 5, No. 1, pp. 10–15.Google Scholar
- [Knut73]Knuth, D. E., The Art of Computer Programming, Vol. 3 (Sorting and Searching), (1973), Addison-Wesley, Reading, MA.Google Scholar
- [ScPP76]Schonhage, A., M. S. Paterson, N. Pippenger, “Finding the Median,” Journal of Computer and System Sciences, (1976), Vol. 13, pp. 184–199.Google Scholar
- [Sing69]Singleton, R. C., “Algorithm 347 (An Efficient Algorithm for Sorting with Minimal Storage),” Comm. of ACM, (1969), Vol. 12, No. 3, pp. 185–187.Google Scholar
- [Will64]Williams, J. W. J., “Algorithm 232 (Heapsort),” Comm. of ACM, (1964), Vol. 7, No. 6, pp. 347–348.Google Scholar