Adaptive sorting: an information theoretic perspective

We present two algorithms that are near optimal with respect to the number of inversions present in the input. One of the algorithms is a variation of insertion sort, and the other is a variation of merge sort. The number of comparisons performed by our algorithms, on an input sequence of length n that has I inversions, is at most $$n\,{\rm log}_{2} (\frac{I}{n} + 1) + O(n)$$ . Moreover, both algorithms have implementations that run in time $$O(n\,{\rm log}_{2} (\frac{I}{n} + 1)\,+\,n)$$ . All previously published algorithms require at least $$cn\,{\rm log}_{2} (\frac{I}{n} + 1)$$ comparisons for some c > 1.

[1]  Robert E. Tarjan,et al.  Design and Analysis of a Data Structure for Representing Sorted Lists , 1978, SIAM J. Comput..

[2]  Christos Levcopoulos,et al.  Sorting Shuffled Monotone Sequences , 1990, SWAT.

[3]  Kurt Mehlhorn Sorting Presorted Files , 1979, Theoretical Computer Science.

[4]  Donald E. Knuth,et al.  The Art of Computer Programming: Volume 3: Sorting and Searching , 1998 .

[5]  Andrew Chi-Chih Yao,et al.  An Almost Optimal Algorithm for Unbounded Searching , 1976, Inf. Process. Lett..

[6]  Alistair Moffat,et al.  A Tree-based Mergesort , 1998, Acta Informatica.

[7]  Alistair Moffat,et al.  A Framework for Adaptive Sorting , 1992, SWAT.

[8]  Amr Elmasry,et al.  Priority Queues, Pairing, and Adaptive Sorting , 2002, ICALP.

[9]  Christos Levcopoulos,et al.  Exploiting Few Inversions When Sorting: Sequential and Parallel Algorithms , 1996, Theor. Comput. Sci..

[10]  Richard Cole,et al.  On the Dynamic Finger Conjecture for Splay Trees. Part II: The Proof , 2000, SIAM J. Comput..

[11]  Christos Levcopoulos,et al.  Splitsort - An Adaptive Sorting Algorithm , 1990, Inf. Process. Lett..

[12]  Leonidas J. Guibas,et al.  A new representation for linear lists , 1977, STOC '77.

[13]  Michael L. Fredman,et al.  How Good is the Information Theory Bound in Sorting? , 1976, Theor. Comput. Sci..

[14]  Derick Wood,et al.  A New Measure of Presortedness , 1989, Inf. Comput..

[15]  Alfred V. Aho,et al.  Data Structures and Algorithms , 1983 .

[16]  Donald E. Knuth,et al.  The art of computer programming: sorting and searching (volume 3) , 1973 .

[17]  Arne Andersson,et al.  Fast Updating of Well-Balanced Trees , 1990, SWAT.

[18]  Svante Carlsson,et al.  Sublinear merging and natural mergesort , 2005, Algorithmica.

[19]  Robert E. Tarjan,et al.  Self-adjusting binary search trees , 1985, JACM.

[20]  Christos Levcopoulos,et al.  Adaptive Heapsort , 1993, J. Algorithms.

[21]  Heikki Mannila,et al.  Measures of Presortedness and Optimal Sorting Algorithms , 1985, IEEE Transactions on Computers.

[22]  Richard Cole,et al.  On the dynamic finger conjecture for splay trees , 1990, STOC '90.

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