Abstract
In a decision tree model, Ω(n log2 n − ∑ i=1m n i log2 n i + n) is known to be a lower bound for sorting a multiset of size n containing m distinct elements, where the ith distinct element appears n t times. We present a minimum space algorithm that sorts stably a multiset in asymptotically optimal worst-case time. A Quicksort type approach is used, where at each recursive step the median is chosen as the partitioning element. To obtain a stable minimum space implemention, we develop linear-time in-place algorithms for the following problems, which have interest of their own: Stable unpartitioning: Assume that an n-element array A is stably partitioned into two subarrays A 0 and A 1. The problem is to recover A from its constituents A 0 and A 1. The information available is the partitioning element used and a bit array of size n indicating whether an element of A 0 or A 1 was originally in the corresponding position of A.
Stable selection: The task is to find the kth smallest element in a multiset of n elements such that the relative order of identical elements is retained.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
M. Blum, R.W. Floyd, V. Pratt, R.L. Rivest, R.E. Tarjan: Time bounds for selection. Journal of Computer and System Sciences 7 (1973) 448–461
S. Carlsson, J.I. Munro, P.V. Poblete: 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
B. Ďurian: Quicksort without a stack. Mathematical Foundations of Computer Science 1986. Lecture Notes in Computer Science 233. Springer-Verlag, 1986, pp. 283–289
T.F. Gonzalez, D.B. Johnson: Sorting numbers in linear expected time and optimal extra space. Information Processing Letters 15 (1982) 119–124
E. Horowitz, S. Sahni: Fundamentals of Computer Algorithms. Computer Science Press, 1978
E.C. Horvath: Stable sorting in asymptotically optimal time and extra space. Journal of the ACM 25 (1978) 177–199
B.-C. Huang, M.A. Langston: Practical in-place merging. Communications of the ACM 31 (1988) 348–352
B.-C. Huang, M.A. Langston: Fast stable merging and sorting in constant extra space. International Conference on Computing and Information, 1989, pp. 71–80
B.-C. Huang, M.A. Langston: Stable dublicate-key extraction with optimal time and space bounds. Acta Informatica 26 (1989) 473–484
J. Katajainen, C. Levcopoulos, O. Petersson: Space-efficient parallel merging. PARLE'92 — Parallel Architectures and Languages Europe (to appear)
J. Katajainen, T. Pasanen: Stable minimum space partitioning in linear time. BIT (to appear)
M.A. Kronrod: Optimal ordering algorithm without operational field. Soviet Mathematics 10 (1969) 744–746
T.W. Lai, D. Wood: Implicit selection. 1st Scandinavian Workshop on Algorithm Theory. Lecture Notes in Computer Science 318. Springer-Verlag, 1988, pp. 14–23
C. Levcopoulos, O. Petersson: An optimal adaptive in-place sorting algorithm. 8th International Conference on Fundamentals of Computation Theory. Lecture Notes in Computer Science 529. Springer-Verlag, 1991, pp. 329–338
C. Levcopoulos, O. Petersson: Sorting shuffled monotone sequences. Information & Computation (to appear)
A.M. Moffat, O. Petersson: An overview of adaptive sorting. Australian Computer Journal (to appear)
J.I. Munro: An implicit data structure supporting insertion, deletion, and search in O(log2 n) time. Journal of Computer and System Sciences 33 (1986) 66–74
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 on Computing 5 (1976) 1–8
J.S. Salowe, W.L. Steiger: Simplified stable merging tasks. Journal of Algorithms 8 (1987) 557–571
J.S. Salowe, W.L. Steiger: Stable unmerging in linear time and constant space. Information Processing Letters 25 (1987) 285–294
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
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1992 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Katajainen, J., Pasanen, T. (1992). Sorting multisets stably in minimum space. In: Nurmi, O., Ukkonen, E. (eds) Algorithm Theory — SWAT '92. SWAT 1992. Lecture Notes in Computer Science, vol 621. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55706-7_37
Download citation
DOI: https://doi.org/10.1007/3-540-55706-7_37
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-55706-7
Online ISBN: 978-3-540-47275-9
eBook Packages: Springer Book Archive