Sorting Shuffled Monotone Sequences

We present a new sorting algorithm which adapts to existing order within the input sequence. Let k be the smallest integer such that a sequence X of length n can be reduced to the empty sequence by the removal of k monotone, increasing or decreasing, subsequences. The algorithm, Slabsort, sorts X in O(n log k) time, without knowing k beforehand, which is optimal in a comparison-based model. In the worst case Slabsort degenerates to a hybrid of Melsort and Exact Quicksort and runs in Θ(n log n) time. Further, k is shown to capture various kinds of existing order proposed in the literature.

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

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

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

[4]  Steven Skiena,et al.  Encroaching lists as a measure of presortedness , 1988, BIT.

[5]  Svante Carlsson,et al.  Sublinear Merging and Natural Merge Sort , 1990, SIGAL International Symposium on Algorithms.

[6]  Roger L. Wainwright,et al.  A class of sorting algorithms based on Quicksort , 1985, CACM.

[7]  Michael L. Fredman,et al.  On computing the length of longest increasing subsequences , 1975, Discret. Math..

[8]  Klaus W. Wagner,et al.  Monotonic Coverings of Finite Sets , 1984, J. Inf. Process. Cybern..

[9]  Donald Ervin Knuth,et al.  The Art of Computer Programming , 1968 .

[10]  Christos Levcopoulos,et al.  Heapsort - Adapted for Presorted Files , 1989, WADS.

[11]  R. Geoff Dromey Exploiting partial order with Quicksort , 1984, Softw. Pract. Exp..

[12]  Curtis R. Cook,et al.  Best sorting algorithm for nearly sorted lists , 1980, CACM.

[13]  Dieter Kratsch,et al.  On Partitions of Permutations into Increasing and Decreasing Subsequences , 1986, J. Inf. Process. Cybern..

[14]  C. Schensted Longest Increasing and Decreasing Subsequences , 1961, Canadian Journal of Mathematics.

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

[16]  Christos Levcopoulos,et al.  Splitsort - An Adaptive Sorting Algorithm , 1990, MFCS.