A Meticulous Analysis of Mergesort Programs

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 log2n−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 log2n+O(n) and 3.25n log2n+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.

[1]  Rajeev Raman,et al.  Sorting in linear time? , 1995, STOC '95.

[2]  Derick Wood,et al.  A survey of adaptive sorting algorithms , 1992, CSUR.

[3]  Sara Baase,et al.  Computer algorithms - introduction to design and analysis (2 ed.) , 1988 .

[4]  P. Gács,et al.  Algorithms , 1992 .

[5]  David A. Patterson,et al.  Computer Organization & Design: The Hardware/Software Interface , 1993 .

[6]  Donald E. Knuth,et al.  The Art of Computer Programming, Volume I: Fundamental Algorithms, 2nd Edition , 1997 .

[7]  Donald E. Knuth,et al.  Axioms and Hulls , 1992, Lecture Notes in Computer Science.

[8]  M. V. Wilkes,et al.  The Art of Computer Programming, Volume 3, Sorting and Searching , 1974 .

[9]  Jukka Teuhola,et al.  Practical In-Place Mergesort , 1996, Nord. J. Comput..

[10]  Bjarne Stroustrup,et al.  The C++ programming language (2nd ed.) , 1991 .

[11]  W. Ames Algorithms (2nd edition) , 1990 .

[12]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[13]  Donald E. Knuth,et al.  The Stanford GraphBase - a platform for combinatorial computing , 1993 .

[14]  Svante Carlsson,et al.  Average-case results on heapsort , 1987, BIT.

[15]  Alistair Moffat,et al.  An Overview of Adaptive Sorting , 1992, Aust. Comput. J..

[16]  Herman H. Goldstine,et al.  Planning and coding of problems for an Electronic Computing Instrument , 1947 .

[17]  Robert Sedgewick,et al.  Queue-Mergesort , 1993, Inf. Process. Lett..

[18]  Robert Sedgewick,et al.  Implementing Quicksort programs , 1978, CACM.