A meticulous analysis of mergesort programs (original) (raw)
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.5_n_ log2 n+O(n) and 3.25_n_ 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”).
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
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.
Google Scholar - S. Baase, Computer Algorithms: Introduction to Design and Analysis, 2nd Edition, Addison-Wesley Publishing Company, Reading, Mass., 1988.
Google Scholar - J. L. Bentley, B. W. Kernighan, and C. J. van Wyk, An elementary C cost model, UNIX Review 9 (1991) 38–48.
Google Scholar - S. Carlsson, Average-case results on Heapsort, BIT 27 (1987) 2–17.
Google Scholar - V. Estivill-Castro and D. Wood, A survey of adaptive sorting algorithms, ACM Computing Surveys 24 (1992) 441–476.
Google Scholar - 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.
Google Scholar - M. J. Golin and R. Sedgewick, Queue-mergesort, Information Processing Letters 48 (1993) 253–259.
Google Scholar - J. Katajainen, T. Pasanen, and J. Teuhola, Practical in-place mergesort, Nordic Journal of Computing, 3 (1996) 27–40.
Google Scholar - B.W. Kernighan and D.M. Ritchie, The C Programming Language, 2nd Edition. Prentice-Hall, Englewood Cliffs, N.J., 1988.
Google Scholar - D.E. Knuth, The Art of Computer Programming, Volume 1: Fundamental Algorithms, Addison-Wesley Publishing Company, Reading, Mass., 1968.
Google Scholar - D. E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching, Addison-Wesley Publishing Company, Reading, Mass., 1973.
Google Scholar - D. E. Knuth, Axioms and Hulls, Lecture Notes in Computer Science 606, Springer-Verlag, Berlin/Heidelberg, Germany, 1992.
Google Scholar - D. E. Knuth, The Stanford GraphBase: A Platform for Combinatorial Computing, Addison-Wesley Publishing Company, Reading, Mass., 1993.
Google Scholar - A. M. Moffat and O. Petersson, An overview of adaptive sorting, The Australian Computer Journal 24 (1992) 70–77.
Google Scholar - D.A.Patterson and J. L. Hennessy, Computer Organization & Design: The Hardware/Software Interface, Morgan Kaufmann Publishers, San Francisco, Calif., 1994.
Google Scholar - R. Sedgewick, Implementing Quicksort programs, Communications of the ACM 21 (1978) 847–857. Corrigendum ibidem 23 (79) 368.
Google Scholar - R. Sedgewick, Algorithms, 2nd Edition, Addison-Wesley Publishing Company, Reading, Mass., 1988.
Google Scholar
Author information
Authors and Affiliations
- Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100, Copenhagen East, Denmark
Jyrki Katajainen - Max-Planck-Institut für Informatik, Im Stadtwald, D-66123, Saarbrücken, Germany
Jesper Larsson Träff
Editor information
Giancarlo Bongiovanni Daniel Pierre Bovet Giuseppe Di Battista
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
- .RIS
- .ENW
- .BIB
- DOI: https://doi.org/10.1007/3-540-62592-5\_74
- Published: 03 June 2005
- Publisher Name: Springer, Berlin, Heidelberg
- Print ISBN: 978-3-540-62592-6
- Online ISBN: 978-3-540-68323-0
- eBook Packages: Springer Book Archive
Keywords
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.