Abstract
A variant of the classical selection problem, called the positioning problem, is considered. In this problem we are given a sequence A[1:n] of size n, an integer k, 1 ≤ k ≤ n, and an ordering function ⧀, and the task is to rearrange the elements of the sequence such that A[k] ⧀ A[j] is false for all j, 1 ≤ j < k, and A[l] ⧀ A[k] is false for all l, k < l ≤ n. We present a Las-Vegas algorithm which carries out this rearrangement efficiently using only a constant amount of additional space even if the input contains equal elements and if only pairwise element comparisons are permitted. To be more precise, the algorithm solves the positioning problem in-place in linear time using at most n + k + o(n) element comparisons, k + o(n) element exchanges, and the probability for succeeding within stated time bounds is at least 1 - e -n Ω(1)
Partially supported by Danish Natural Science Research Council under contract 9701414 (project Experimental Algorithmics) and contract 9801749 (project Performance Engineering).
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
M. Blum, R. W. Floyd, V. Pratt, R. L. Rivest, AND R. E. Tarjan, Time bounds for selection, Journal of Computer and System Sciences 7 (1973), 448–461.
S. Carlsson AND M. Sundström, Linear-time in-place selection in less than 3n comparisons, Proceedings of the 6th International Symposium on Algorithms and Computation, Lecture Notes in Computer Science 1004, Springer-Verlag, Berlin/Heidelberg (1995), 244–253.
W. Cunto AND J. I. Munro, Average case selection, Journal of the ACM 36 (1989), 270–279.
R. W. Floyd AND R. L. Rivest, Expected time bounds for selection, Communications of the ACM 18 (1975), 165–172.
V. Geffert, Linear-time in-place selection in ɛ · n element moves, Unpublished typescript (2000).
V. Geffert, J. Katajainen, AND T. Pasanen, Asymptotically efficient in-place merging, Theoretical Computer Science 237 (2000), 159–181.
C. A. R. Hoare, Algorithm 65: Find, Communications of the ACM 4 (1961), 321–322.
J. Katajainen AND T. Pasanen, Stable minimum space partitioning in linear time, BIT 32 (1992), 580–585.
J. Katajainen AND T. Pasanen, Sorting multiset stably in minimum space, Acta Informatica 31 (1994), 301–313.
J. Katajainen, T. Pasanen, AND J. Teuhola, Practical in-place mergesort, Nordic Journal of Computing 3 (1996), 27–40.
J. Katajainen AND T. A. Pasanen, In-place sorting with fewer moves, Information Processing Letters 70 (1999), 31–37.
P. Kirschenhofer, H. Prodinger, AND C. Martínez, Analysis of Hoare’s Find algorithm with median-of-three partition, Random Structures and Algorithms 10 (1997), 143–156.
T. W. Lai AND D. Wood, Implicit selection, Proceedings of the 1st Scandinavian Workshop on Algorithm Theory, Lecture Notes in Computer Science 318, Springer-Verlag, Berlin/Heidelberg (1988), 14–23.
C. Levcopoulos AND O. Petersson, Exploiting few inversions when sorting: Sequential and parallel algorithms, Theoretical Computer Science 163 (1996), 211–238.
R. Motwani AND P. Raghavan, Randomized Algorithms, Cambridge University Press, Cambridge (1995).
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. T. Postamus, A. H. G. Rinnooy Kan, AND G. T. Timmer, An efficient dynamic selection method, Communications of the ACM 26 (1983), 878–881.
A. Schönhage, M. S. Paterson, AND N. Pippenger, Finding the median, Journal of Computer and System Sciences 13 (1976), 184–199.
R. Sedgewick, The analysis of Quicksort programs, Acta Informatica 7 (1977), 327–355.
J.W.J. Williams, Algorithm 232: Heapsort, Communications of the ACM 7 (1964), 347–348.
L. Yde, Performance engineering the nth element function, CPH STL Report 2002-4, Department of Computing, University of Copenhagen, Copenhagen (2002). Available at http://www.cphstl.dk.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Katajainen, J., Pasanen, T.A. (2002). A Randomized In-Place Algorithm for Positioning the kth Element in a Multiset. In: Penttonen, M., Schmidt, E.M. (eds) Algorithm Theory — SWAT 2002. SWAT 2002. Lecture Notes in Computer Science, vol 2368. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45471-3_42
Download citation
DOI: https://doi.org/10.1007/3-540-45471-3_42
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43866-3
Online ISBN: 978-3-540-45471-7
eBook Packages: Springer Book Archive