Abstract
In the stable0–1 sorting problem the task is to sort an array ofn elements with two distinct values such that equal elements retain their relative input order. Recently, Munro, Raman and Salowe gave an algorithm which solves this problem inO(n log*n) time and constant extra space. We show that by a modification of their method the stable0–1 sorting is possible inO(n) time andO(1) extra space. Stable three-way partitioning can be reduced to stable0–1 sorting. This immediately yields a stable minimum space quicksort, which sorts multisets in asymptotically optimal time with high probability.
Similar content being viewed by others
References
J. Bentley,Programming Pearls, Addison-Wesley, 1986.
S. Carlsson, J. I. Munro, P. V. Poblette,An implicit binomial queue with constant insertion time, 1st Scandinavian Workshop on Algorithm Theory, Lecture Notes in Computer Science 318, Springer-Verlag, 1988, pp. 1–13.
D. Ďurian,Quicksort without a stack, Mathematical Foundations of Computer Science 1986, Lecture Notes in Computer Science 233, Springer-Verlag, 1986, pp. 283–289.
C. Levcopoulos, O. Petersson,An optimal adaptive in-place sorting algorithm, 8th International Conference of Fundamentals of Computation Theory, Lecture Notes in Computer Science 529, Springer-Verlag, 1991, pp. 329–338.
J. I. Munro, V. Raman,Sorting multisets and vectors in-place, 2nd Workshop on Algorithms and Data Structures, Lecture Notes in Computer Science 519, Springer-Verlag, 1991, pp. 473–480.
J. I. Munro, V. Raman, J. S. Salowe,Stable in situ sorting and minimum data movement, BIT 30 (1990) 220–234.
J. I. Munro, P. M. Spira,Sorting and searching in multisets, SIAM Journal of Computing 5 (1976) 1–8.
P. Raghavan,Lecture notes on randomized algorithms, Computer Science Report RC 15340, IBM Research Division, T. J. Watson Research Center, 1990.
J. S. Salowe, W. L. Steiger,Stable unmerging in linear time and constant space, Information Processing Letters 25 (1987) 285–294.
R. Seidel,Backwards analysis of randomized geometric algorithms, Technical Report, Computer Science Division, University of California Berkeley, 1991.
S. Sen,Random sampling techniques for efficient parallel algorithms in computational geometry, Ph.D. thesis, Computer Science Department, Duke University, 1989.
L. M. Wegner,Quicksort for equal keys, IEEE Transactions on Computers C34 (1985) 362–367.
L. M. Wegner,A generalized, one-way, stackless quicksort, BIT 27 (1987) 44–48.