Improved Average Complexity for Comparison-Based Sorting

  • Kazuo Iwama
  • Junichi TeruyamaEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10389)


This paper studies the average complexity on the number of comparisons for sorting algorithms. Its information-theoretic lower bound is \(n \lg n - 1.4427n + O(\log n)\). For many efficient algorithms, the first \(n\lg n\) term is easy to achieve and our focus is on the (negative) constant factor of the linear term. The current best value is \(-1.3999\) for the MergeInsertion sort. Our new value is \(-1.4106\), narrowing the gap by some \(25\%\). An important building block of our algorithm is “two-element insertion,” which inserts two numbers A and B, \(A<B\), into a sorted sequence T. This insertion algorithm is still sufficiently simple for rigorous mathematical analysis and works well for a certain range of the length of T for which the simple binary insertion does not, thus allowing us to take a complementary approach with the binary insertion.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Ayala-Rincón, M., De Abreu, B.T., De Siqueira, J.: A variant of the Ford-Johnson algorithm that is more space efficient. Information Processing Letters 102(5), 201–207 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Edelkamp, S., Weiß, A.: QuickXsort: Efficient Sorting with n logn - 1.399n + o(n) Comparisons on Average. In: CSR 2014, pp. 139–152Google Scholar
  3. 3.
    Ford, L.R., Johnson, S.M.: A tournament problem. The American Mathematical Monthly 66(5), 387–389 (1959)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Hwang, F.K., Lin, S.: Optimal merging of 2 elements with n elements. Acta Informatica 1, 145–158 (1971)MathSciNetCrossRefzbMATHGoogle Scholar
  5. 5.
    Iwama, K., Teruyama, J.: Improved Average Complexity for Comparison-Based Sorting (2017). arXiv:1705.00849
  6. 6.
    Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. 3, 2nd edn. Addison Wesley Longman Publishing Co. Inc., Redwood City (1998)zbMATHGoogle Scholar
  7. 7.
    Manacher, G.K.: The Ford-Johnson algorithm is not optimal. Journal of the Association for Computing Machinery 26, 441–456 (1979)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Manacher, G.K., Bui, T.D., Mai, T.: Optimum combinations of sorting and merging. Journal of the Association for Computing Machinery 36, 290–334 (1989)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Schulte, J.: Mönting, Merging of 4 or 5 elements with n elements. Theoretical Computer Science 14, 19–37 (1981)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Peczarski, M.: Sorting 13 elements requires 34 comparisons. In: Möhring, R., Raman, R. (eds.) ESA 2002. LNCS, vol. 2461, pp. 785–794. Springer, Heidelberg (2002). doi: 10.1007/3-540-45749-6_68 CrossRefGoogle Scholar
  11. 11.
    Peczarski, M.: New results in minimum-comparison sorting. Algorithmica 40(2), 133–145 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Peczarski, M.: The Ford-Johnson algorithm still unbeaten for less than 47 elements. Information processing letters 101(3), 126–128 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Steinhaus, H.: Mathematical Snapshots, New Nork, pp. 37–40 (1950)Google Scholar
  14. 14.
    Thanh, M., Alagar, V.S., Bui, T.D.: Optimal Expected-Time Algorithms for Merging. J. Algorithms 7(3), 341–357 (1986)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Wells, M.: Applications of a language for computing in combinatorics. In: Proc. 1965 IFIP Congress, pp. 497–498. North-Holland, Amsterdam (1966)Google Scholar

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.Kyoto UniversityKyotoJapan
  2. 2.National Institute of InformaticsTokyoJapan
  3. 3.JST, ERATO, Kawarabayashi Large Graph ProjectChiyodaJapan

Personalised recommendations