WADS 2017: Algorithms and Data Structures pp 485-496

# Improved Average Complexity for Comparison-Based Sorting

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

## Abstract

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.

## References

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)
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)
4. 4.
Hwang, F.K., Lin, S.: Optimal merging of 2 elements with n elements. Acta Informatica 1, 145–158 (1971)
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)
7. 7.
Manacher, G.K.: The Ford-Johnson algorithm is not optimal. Journal of the Association for Computing Machinery 26, 441–456 (1979)
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)
9. 9.
Schulte, J.: Mönting, Merging of 4 or 5 elements with n elements. Theoretical Computer Science 14, 19–37 (1981)
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:
11. 11.
Peczarski, M.: New results in minimum-comparison sorting. Algorithmica 40(2), 133–145 (2004)
12. 12.
Peczarski, M.: The Ford-Johnson algorithm still unbeaten for less than 47 elements. Information processing letters 101(3), 126–128 (2007)
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)
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