Abstract
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 log2 n 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.
Preview
Unable to display preview. Download preview PDF.
References
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.
C.R. Cook and D.J. Kim. Best sorting algorithms for nearly sorted lists. Communications of the ACM, 23(11):620–624, 1980.
V. Estivill-Castro and D. Wood. A new measure of presortedness. Information and Computation, 83(1):111–119, 1989.
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.
B-C. Huang and M.A. Langston. Practical in-place merging. CACM, 31(3):348–352, 1988.
C. Levcopoulos and O. Petersson. Heapsort—adapted for presorted files. In Proc. 1989 WADS, pages 499–509. LNCS 382, Springer-Verlag, 1989.
C. Levcopoulos and O. Petersson. Sorting shuffled monotone sequences. In Proc. 2nd SWAT. LNCS, Springer-Verlag, 1990. To appear.
H. Mannila. Measures of presortedness and optimal sorting algorithms. IEEE Transactions on Computers, C-34(4):318–325, 1985.
K. Mehlhorn. Data Structures and Algorithms, Vol 1: Sorting and Searching. 1984.
S.S. Skiena. Encroaching lists as a measure of presortedness. BIT, 28(4):775–784, 1988.
R.L. Wainwright. A class of sorting algorithms based on Quicksort. CACM, 28(4):396–402, 1985.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1990 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Levcopoulos, C., Petersson, O. (1990). Splitsort—an adaptive sorting algorithm. In: Rovan, B. (eds) Mathematical Foundations of Computer Science 1990. MFCS 1990. Lecture Notes in Computer Science, vol 452. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0029637
Download citation
DOI: https://doi.org/10.1007/BFb0029637
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-52953-8
Online ISBN: 978-3-540-47185-1
eBook Packages: Springer Book Archive