Advertisement

The Average Case Analysis of Partition Sorts

  • Richard Cole
  • David C. Kandathil
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3221)

Abstract

This paper introduces a new family of in-place sorting algorithms, the partition sorts. They are appealing both for their relative simplicity and their efficient performance. They perform Θ(n log n) operations on the average, and \(\Theta(n \log^2\!n)\) operations in the worst case.

The partition sorts are related to another family of sorting algorithms discovered recently by Chen [Che02]. He showed empirically that one version ran faster, on the average, than quicksort, and that the algorithm family performed Θ(n log n) comparisons in the worst case; however no average case analysis was obtained.

This paper completes the analysis of Chen’s algorithm family. In particular, a bound of n log n +O(n) comparisons and Θ(n log n) operations is shown for the average case, and \(\Theta (n \log^2\!n)\) operations for the worst case. The average case analysis is somewhat unusual. It proceeds by showing that Chen’s sorts perform, on the average, no more comparisons than the partition sorts.

Optimised versions of the partition sort and Chen’s algorithm are very similar in performance, and both run marginally faster than an optimised quasi-best-of-nine variant of quicksort [BM93]. They both have a markedly smaller variance than the quicksorts.

Keywords

Recursive Call Additional Space Operation Count Input Ordering Cache Behaviour 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Ben00]
    Bentley, J.L.: Programming Pearls, 2nd edn. Addison-Wesley, Reading (2000)Google Scholar
  2. [BM93]
    Bentley, J.L., Douglas McIlroy, M.: Engineering a sort function. Software Practice and Experience 23(11), 1249–1265 (1993)CrossRefGoogle Scholar
  3. [Che96]
    Chen, J.-C.: Proportion split sort. Nordic Journal of Computing 3(3), 271–279 (Fall 1996)Google Scholar
  4. [Che02]
    Chen, J.-C.: Proportion extend sort. SIAM Journal on Computing 31(1), 323–330 (2002)CrossRefGoogle Scholar
  5. [Dut93]
    Dutton, R.D.: Weak-heapsort. BIT 33(3), 372–381 (1993)CrossRefMathSciNetGoogle Scholar
  6. [EW00]
    Edelkamp, S., Wegener, I.: On the performance of weak-heapsort. In: Reichel, H., Tison, S. (eds.) STACS 2000. LNCS, vol. 1770, pp. 254–266. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  7. [FG03]
    Franceschini, G., Geffert, V.: An in-place sorting with O(n log n) comparisons and O(n) moves. In: Proceedings of the 44th Annual IEEE Symposium on Foundations of Computer Science (FOCS), Cambridge, Massachusetts, October 11-14, pp. 242–250 (2003)Google Scholar
  8. [FJ59]
    Ford Jr., L.R., Johnson, S.M.: A tournament problem. The American Mathematical Monthly 66(5), 387–389 (1959)zbMATHCrossRefMathSciNetGoogle Scholar
  9. [Flo64]
    Floyd, R.W.: ACM Algorithm 245: Treesort 3. Communications of the ACM 7(12), 701 (1964)CrossRefGoogle Scholar
  10. [Hoa61]
    Hoare, C.A.R.: ACM Algorithm 63: Partition, ACM Algorithm 64: Quicksort. Communications of the ACM 4(7), 321–322 (1961)CrossRefGoogle Scholar
  11. [Hoa62]
    Hoare, C.A.R.: Quicksort. The Computer Journal 5(1), 10–16 (1962)zbMATHCrossRefMathSciNetGoogle Scholar
  12. [Knu73]
    Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. 3. Addison-Wesley, Reading (1973)Google Scholar
  13. [KPT96]
    Katajainen, J., Pasanen, T., Teuhola, J.: Practical in-place mergesort. Nordic Journal of Computing 3(1), 27–40 (Spring 1996)MathSciNetGoogle Scholar
  14. [LL97]
    LaMarca, A., Ladner, R.E.: The influence of caches on the performance of sorting. In: Proceedings of the Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, New Orleans, Louisiana, January 5-7, pp. 370–379 (1997)Google Scholar
  15. [Mus97]
    Musser, D.R.: Introspective sorting and selection algorithms. Software Practice and Experience 27(8), 983–993 (1997)CrossRefGoogle Scholar
  16. [Rei85]
    Reischuk, R.: Probabilistic parallel algorithms for sorting and selection. SIAM Journal on Computing 14(2), 396–409 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  17. [Rei92]
    Reinhardt, K.: Sorting in-place with a worst case complexity of n log n – 1.3n + o(log n) comparisons and εn log n + o(1) transports. In: Ibaraki, T., Iwama, K., Yamashita, M., Inagaki, Y., Nishizeki, T. (eds.) ISAAC 1992. LNCS, vol. 650, pp. 489–498. Springer, Heidelberg (1992)Google Scholar
  18. [Sed78]
    Sedgewick, R.: Implementing quicksort programs. Communications of the ACM 21(10), 847–857 (1978)zbMATHCrossRefGoogle Scholar
  19. [Sin69]
    Singleton, R.C.: An efficient algorithm for sorting with minimal storage. Communications of the ACM 12(3), 185–187 (1969)CrossRefGoogle Scholar
  20. [Weg93]
    Wegener, I.: Bottom-up heapsort, a new variant of heapsort, beating, on an average, quicksort (if n is not very small). Theoretical Computer Science 118(1), 81–98 (1993)zbMATHCrossRefMathSciNetGoogle Scholar
  21. [Wil64]
    Williams, J.W.J.: ACM Algorithm 232: Heapsort. Communications of the ACM 7(6), 347–348 (1964)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Richard Cole
    • 1
  • David C. Kandathil
    • 1
  1. 1.Computer Science Department, Courant InstituteNew York UniversityNew YorkUSA

Personalised recommendations