Splitsort—an adaptive sorting algorithm

  • Christos Levcopoulos
  • Ola Petersson
Part of the Lecture Notes in Computer Science book series (LNCS, volume 452)


We present a new sorting algorithm, called Splitsort which adapts to existing order within the input sequence. The algorithm is optimal with respect to several known measures of presortedness, including the number of inversions, for which no such simple and space efficient algorithm was known before. The amount of extra space needed is only n + O(log n) pointers. Splitsort uses a simple data structure and is easy to code. In the worst case Splitsort performs 2.5 n log2n comparisons, but if the input is presorted according to some of the measures it completes the sorting task considerably faster. We also show how a variant of the algorithm can be implemented to run in-place.


Sorting Algorithm Sorting Task Extra Space Unordered Pair Input Array 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    S. Carlsson, C. Levcopoulos, and O. Petersson. Sublinear merging and Natural Merge Sort. In Proc. SIGAL Int. Symp. on Algorithms. LNCS, Springer-Verlag, 1990. To appear.Google Scholar
  2. [2]
    C.R. Cook and D.J. Kim. Best sorting algorithms for nearly sorted lists. Communications of the ACM, 23(11):620–624, 1980.Google Scholar
  3. [3]
    V. Estivill-Castro and D. Wood. A new measure of presortedness. Information and Computation, 83(1):111–119, 1989.Google Scholar
  4. [4]
    L.J. Guibas, E.M. McCreight, M.F. Plass, and J.R. Roberts. A new representation of linear lists. In Proc. 9th Annual ACM Symposium on Theory of Computing, pages 49–60, 1977.Google Scholar
  5. [5]
    B-C. Huang and M.A. Langston. Practical in-place merging. CACM, 31(3):348–352, 1988.Google Scholar
  6. [6]
    C. Levcopoulos and O. Petersson. Heapsort—adapted for presorted files. In Proc. 1989 WADS, pages 499–509. LNCS 382, Springer-Verlag, 1989.Google Scholar
  7. [7]
    C. Levcopoulos and O. Petersson. Sorting shuffled monotone sequences. In Proc. 2nd SWAT. LNCS, Springer-Verlag, 1990. To appear.Google Scholar
  8. [8]
    H. Mannila. Measures of presortedness and optimal sorting algorithms. IEEE Transactions on Computers, C-34(4):318–325, 1985.Google Scholar
  9. [9]
    K. Mehlhorn. Data Structures and Algorithms, Vol 1: Sorting and Searching. 1984.Google Scholar
  10. [10]
    S.S. Skiena. Encroaching lists as a measure of presortedness. BIT, 28(4):775–784, 1988.Google Scholar
  11. [11]
    R.L. Wainwright. A class of sorting algorithms based on Quicksort. CACM, 28(4):396–402, 1985.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1990

Authors and Affiliations

  • Christos Levcopoulos
    • 1
  • Ola Petersson
    • 1
  1. 1.Algorithm Theory Group, Dept. of Computer ScienceLund UniversityLundSweden

Personalised recommendations