Derivation of Randomized Sorting and Selection Algorithms

  • Sanguthevar Rajasekaran
  • John H. Reif
Part of the The Springer International Series In Engineering and Computer Science book series (SECS, volume 231)


In this paper we systematically derive randomized algorithms (both sequential and parallel) for sorting and selection from basic principles and fundamental techniques like random sampling. We prove several sampling lemmas which will find independent applications. The new algorithms derived here are the most efficient known. From among other results, we have an efficient algorithm for sequential sorting.

The problem of sorting has attracted so much attention because of its vital importance. Sorting with as few comparisons as possible while keeping the storage size minimum is a long standing open problem. This problem is referred to as ‘the minimum storage sorting’ [10] in the literature. The previously best known minimum storage sorting algorithm is due to Frazer and McKellar [10]. The expected number of comparisons made by this algorithm is n log n + O(n log log n). The algorithm we derive in this paper makes only an expected n log n + O(n ω(n)) number of comparisons, for any function ω(n) that tends to infinity. A variant of this algorithm makes no more than n log n + O(n log log n) comparisons on any input of size n with overwhelming probability.

We also prove high probability bounds for several randomized algorithms for which only expected bounds have been proven so far.


Sorting Algorithm Overwhelming Probability Random Access Machine Parallel Random Access Machine Select Algorithm 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. Aho, J.E. Hopcroft, and J.D. Ullman, The Design and Analysis of Algorithms, Addison-Wesley Publications, 1976.Google Scholar
  2. [2]
    M. Ajtai, J. Komlós, and E. Szemerédi, An O(n log n) Sorting Network, in Proc. ACM Symposium on Theory of Computing, 1983, pp. 1–9.Google Scholar
  3. [3]
    D. Angluin and L.G. Valiant, Fast Probabilistic Algorithms for Hamiltonian Circuits and Matchings, Journal of Computer Systems and Science 18, 2, 1979, pp. 155–193.MATHCrossRefGoogle Scholar
  4. [4]
    S. Carlsson, A Variant of Heapsort with Almost Optimal Number of Comparisons, Information Processing Letters 24, 1987, pp. 247–250.MATHCrossRefGoogle Scholar
  5. [5]
    S. Carlsson, Average Case Results on Heapsort, BIT 27, 1987, pp. 2–17.MATHCrossRefGoogle Scholar
  6. [6]
    H. Chernoff, A Measure of Asymptotic Efficiency for Tests of a Hypothesis Based on the Sum of Observations, Annals of Mathematical Statistics 23, 1952, pp. 493–507.Google Scholar
  7. [7]
    R. Cole, Parallel Merge Sort, SIAM Journal on Computing, vol. 17, no. 4, 1988, pp. 770–785.MATHCrossRefGoogle Scholar
  8. [8]
    R. Cole, An Optimally Efficient Selection Algorithm, Information Processing Letters 26, Jan. 1988, pp. 295–299.Google Scholar
  9. [9]
    R. Cole and U. Vishkin, Approximate and Exact Parallel Scheduling with Applications to List, Tree, and Graph Problems, in Proc. IEEE Symposium on Foundations of Computer Science, 1986, pp. 478–491.Google Scholar
  10. [10]
    W.D. Frazer and A.C. McKellar, Samplesort: A Sampling Approach to Minimal Storage Tree Sorting, Journal of the ACM, vol.17, no.3, 1970, pp. 496–507.MATHCrossRefGoogle Scholar
  11. [11]
    R. Floyd and R. Rivest, Expected Time Bounds for Selection, Communications of the ACM, vol. 18, no. 3, 1975, pp. 165–172.MATHCrossRefGoogle Scholar
  12. [12]
    C.A.R. Hoare, Quicksort, Computer Journal 5, 1962, pp. 10–15.MATHCrossRefGoogle Scholar
  13. [13]
    C. Kaklamanis, D. Krizanc, L. Narayanan, and Th. Tsantilas, Randomized Sorting and Selection on Mesh Connected Processor Arrays, Proc. 3rd Annual ACM Symposium on Parallel Algorithms and Architectures, 1991.Google Scholar
  14. [14]
    L. Kleinrock, Queueing Theory. Volume 1: Theory, John Wiley & Sons, 1975.Google Scholar
  15. [15]
    D. Kozen, Semantics of Probabilistic Programs, Journal of Computer and Systems Science, vol. 22, 1981, pp. 328–350.MATHCrossRefGoogle Scholar
  16. [16]
    D.E. Knuth, The Art of Computer Programming, vol. 3, Sorting and Searching, Addison-Wesley Publications, 1973.Google Scholar
  17. [17]
    T. Leighton, Tight Bounds on the Complexity of Parallel Sorting, in Proc. ACM Symposium on Theory of Computing, 1984, pp. 71–80.Google Scholar
  18. [18]
    F.P. Preparata, New Parallel Sorting Schemes, IEEE Transactions on Computers, vol. C27, no. 7, 1978, pp. 669–673.Google Scholar
  19. [19]
    M.O. Rabin, Probabilistic Algorithms, in Algorithms and Complexity, New Directions and Recent Results, edited by J. Traub, Academic Press, 1976, pp. 21–36.Google Scholar
  20. [20]
    S. Rajasekaran, k-k Routing, k-k Sorting, and Cut Through Routing on the Mesh, Technical Report MS-CIS-91-93, Department of CIS, University of Pennsylvania, October 1991. Also presented in the 4th Annual ACM Symposium on Parallel Algorithms and Architectures, 1992.Google Scholar
  21. [21]
    S. Rajasekaran, Mesh Connected Computers with Fixed and Reconfigurable Buses: Packet Routing, Sorting, and Selection, Technical Report MS-CIS-92-56, Department of CIS, University of Pennsylvania, July 1992.Google Scholar
  22. [22]
    S. Rajasekaran, Randomized Parallel Selection, Proc. Tenth Conference on Foundations of Software Technology and Theoretical Computer Science, Bangalore, India, 1990. Springer-Verlag Lecture Notes in Computer Science 472, pp. 215–224.Google Scholar
  23. [23]
    S. Rajasekaran and J.H. Reif, Optimal and Sub Logarithmic Time Randomized Parallel Sorting Algorithms, SIAM Journal on Computing, vol. 18, no. 4, 1989, pp. 594–607.MATHCrossRefGoogle Scholar
  24. [24]
    S. Rajasekaran and D.S.L. Wei, Selection, Routing, and Sorting on the Star Graph, to appear in Proc. 7th International Parallel Processing Symposium, 1993.Google Scholar
  25. [25]
    J.H. Reif and L.G. Valiant, A Logarithmic Time Sort for Linear Size Networks, in Proc. 15th Annual ACM Symposium on Theory of Computing, Boston, MASS., 1983, pp. 10–16.Google Scholar
  26. [26]
    J.H. Reif, An n1+ε Processor O(log log n) Time Probabilistic Sorting Algorithm, in Proc. SIAM Symposium on the Applications of Discrete Mathematics, Cambridge, MASS., 1983, pp. 27–29.Google Scholar
  27. [27]
    R. Reischuk, Probabilistic Parallel Algorithms for Sorting and Selection, SIAM Journal on computing, vol. 14, 1985, pp. 396–409.MATHCrossRefGoogle Scholar
  28. [28]
    S. Sen, Finding an Approximate Median with High Probability in Constant Parallel Time, Information Processing Letters 34, 1990, pp. 77–80.MATHCrossRefGoogle Scholar
  29. [29]
    Y. Shiloach, and U. Vishkin, Finding the Maximum, Merging, and Sorting in a Parallel Computation Model, Journal of Algorithms 2, 1981, pp. 81–102.Google Scholar
  30. [30]
    R. Solovay and V. Strassen, A Fast Monte-Carlo Test for Primality, SIAM Journal on Computing, vol. 6, 1977, pp. 84–85.MATHCrossRefGoogle Scholar
  31. [31]
    L.G. Valiant, Parallelism in Comparison Problems, SIAM Journal on Computing, vol. 4, 1975, pp. 348–355.MATHCrossRefGoogle Scholar
  32. [32]
    I. Wegener, Bottom-up-Heapsort, a New Variant of Heapsort Beating of Average Quicksort (if n is not very small), in Proc. Mathematical Foundations of Computer Science, Springer-Verlag Lecture Notes in Computer Science 452, 1990, pp. 516–522.Google Scholar

Copyright information

© Kluwer Academic Publishers 1993

Authors and Affiliations

  • Sanguthevar Rajasekaran
    • 1
  • John H. Reif
    • 2
  1. 1.Dept. of CISUniversity of PennsylvaniaUSA
  2. 2.Dept. of Computer ScienceDuke UniversityUSA

Personalised recommendations