Abstract
The efficiency of mergesort programs is analysed under a simple unit-cost model. In our analysis the time performance of the sorting programs includes the costs of key comparisons, element moves and address calculations. The goal is to establish the best possible time-bound relative to the model when sorting n integers. By the well-known information-theoretic argument n log2 n−O(n) is a lower bound for the integer-sorting problem in our framework. New implementations for two-way and four-way bottom-up mergesort are given, the worst-case complexities of which are shown to be bounded by 5.5n log2 n+O(n) and 3.25n log2 n+O(n), respectively. The theoretical findings are backed up with a series of experiments which show the practical relevance of our analysis when implementing library routines for internal-memory computations.
Supported partially by the Danish Natural Science Research Council under contract No. 9400952 (project “Computational Algorithmics”).
This is a preview of subscription content, log in via an institution.
Preview
Unable to display preview. Download preview PDF.
References
A. Andersson, T. Hagerup, S. Nilsson, and R. Raman, Sorting in linear time?, in Proceedings of the 27th Annual ACM Symposium on the Theory of Computing, ACM Press, New York, N.Y., 1995, pp. 427–436.
S. Baase, Computer Algorithms: Introduction to Design and Analysis, 2nd Edition, Addison-Wesley Publishing Company, Reading, Mass., 1988.
J. L. Bentley, B. W. Kernighan, and C. J. van Wyk, An elementary C cost model, UNIX Review 9 (1991) 38–48.
S. Carlsson, Average-case results on Heapsort, BIT 27 (1987) 2–17.
V. Estivill-Castro and D. Wood, A survey of adaptive sorting algorithms, ACM Computing Surveys 24 (1992) 441–476.
H. H. Goldstine and J. von Neumann, Planning and coding of problems for an electronic computing instrument, Part II, Volume 2, reprinted in John von Neumann Collected Works, Volume V: Design of Computers, Theory of Automata and Numerical Analysis, Pergamon Press, Oxford, England, 1963, pp. 152–214.
M. J. Golin and R. Sedgewick, Queue-mergesort, Information Processing Letters 48 (1993) 253–259.
J. Katajainen, T. Pasanen, and J. Teuhola, Practical in-place mergesort, Nordic Journal of Computing, 3 (1996) 27–40.
B.W. Kernighan and D.M. Ritchie, The C Programming Language, 2nd Edition. Prentice-Hall, Englewood Cliffs, N.J., 1988.
D.E. Knuth, The Art of Computer Programming, Volume 1: Fundamental Algorithms, Addison-Wesley Publishing Company, Reading, Mass., 1968.
D. E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching, Addison-Wesley Publishing Company, Reading, Mass., 1973.
D. E. Knuth, Axioms and Hulls, Lecture Notes in Computer Science 606, Springer-Verlag, Berlin/Heidelberg, Germany, 1992.
D. E. Knuth, The Stanford GraphBase: A Platform for Combinatorial Computing, Addison-Wesley Publishing Company, Reading, Mass., 1993.
A. M. Moffat and O. Petersson, An overview of adaptive sorting, The Australian Computer Journal 24 (1992) 70–77.
D.A.Patterson and J. L. Hennessy, Computer Organization & Design: The Hardware/Software Interface, Morgan Kaufmann Publishers, San Francisco, Calif., 1994.
R. Sedgewick, Implementing Quicksort programs, Communications of the ACM 21 (1978) 847–857. Corrigendum ibidem 23 (79) 368.
R. Sedgewick, Algorithms, 2nd Edition, Addison-Wesley Publishing Company, Reading, Mass., 1988.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1997 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Katajainen, J., Träff, J.L. (1997). A meticulous analysis of mergesort programs. In: Bongiovanni, G., Bovet, D.P., Di Battista, G. (eds) Algorithms and Complexity. CIAC 1997. Lecture Notes in Computer Science, vol 1203. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-62592-5_74
Download citation
DOI: https://doi.org/10.1007/3-540-62592-5_74
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-62592-6
Online ISBN: 978-3-540-68323-0
eBook Packages: Springer Book Archive