Abstract
MergeInsertion, also known as the Ford-Johnson algorithm, is a sorting algorithm which, up to today, for many input sizes achieves the best known upper bound on the number of comparisons. Indeed, it gets extremely close to the information-theoretic lower bound. While the worst-case behavior is well understood, only little is known about the average case. This work takes a closer look at the average case behavior. In particular, we establish an upper bound of \(n \log n - 1.4005n + o(n)\) comparisons. We also give an exact description of the probability distribution of the length of the chain a given element is inserted into and use it to approximate the average number of comparisons numerically. Moreover, we compute the exact average number of comparisons for n up to 148. Furthermore, we experimentally explore the impact of different decision trees for binary insertion. To conclude, we conduct experiments showing that a slightly different insertion order leads to a better average case and we compare the algorithm to the recent combination with (1,2)-Insertionsort by Iwama and Teruyama.
The second author has been supported by the German Research Foundation (DFG) under grant DI 435/7-1.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Boehm, H.J., Atkinson, R., Plass, M.: Ropes: an alternative to strings. Softw. Pract. Exper. 25(12), 1315–1330 (1995)
Bui, T., Thanh, M.: Significant improvements to the Ford-Johnson algorithm for sorting. BIT Numer. Math. 25(1), 70–75 (1985)
Edelkamp, S., Weiß, A.: QuickXsort: efficient sorting with n log \({n}-1.399{n}+{o}({n})\) comparisons on average. In: Hirsch, E.A., Kuznetsov, S.O., Pin, J.É., Vereshchagin, N.K. (eds.) CSR 2014. LNCS, vol. 8476, pp. 139–152. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-06686-8_11
Edelkamp, S., Weiß, A., Wild, S.: Quickxsort - A fast sorting scheme in theory and practice. CoRR abs/1811.01259 (2018)
Ford, L.R., Johnson, S.M.: A tournament problem. Am. Math. Monthly 66(5), 387–389 (1959)
Iwama, K., Teruyama, J.: Improved average complexity for comparison-based sorting. Algorithms and Data Structures. LNCS, vol. 10389, pp. 485–496. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-62127-2_41
Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, 2nd Edn, vol. 3. Addison Wesley Longman, Redwood City (1998)
Manacher, G.K.: The Ford-Johnson sorting algorithm is not optimal. J. ACM 26(3), 441–456 (1979)
Peczarski, M.: New results in minimum-comparison sorting. Algorithmica 40(2), 133–145 (2004)
Peczarski, M.: The Ford-Johnson algorithm still unbeaten for less than 47 elements. Inf. Process. Lett. 101(3), 126–128 (2007)
Reinhardt, K.: Sorting in-place with a worst case complexity of n log n-1.3n + O(logn) comparisons and epsilon n log n + O(1) transports. In: Proceedings of Algorithms and Computation, ISAAC 1992, pp. 489–498 (1992)
Stober, F.: Source code and generated data (2018). https://github.com/CodeCrafter47/merge-insertion
Stober, F., Weiß, A.: On the Average Case of MergeInsertion. arXiv e-prints. abs/1905.09656 (2019)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Stober, F., Weiß, A. (2019). On the Average Case of MergeInsertion. In: Colbourn, C., Grossi, R., Pisanti, N. (eds) Combinatorial Algorithms. IWOCA 2019. Lecture Notes in Computer Science(), vol 11638. Springer, Cham. https://doi.org/10.1007/978-3-030-25005-8_34
Download citation
DOI: https://doi.org/10.1007/978-3-030-25005-8_34
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-25004-1
Online ISBN: 978-3-030-25005-8
eBook Packages: Computer ScienceComputer Science (R0)