A Randomized In-Place Algorithm for Positioning the kth Element in a Multiset

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).

[1]  H. Prodinger,et al.  Analysis of Hoare's FIND algorithm with median-of-three partition , 1997 .

[2]  Alexander H. G. Rinnooy Kan,et al.  An efficient dynamic selection method , 1983, CACM.

[3]  Svante Carlsson,et al.  Linear-time In-place Selection in Less than 3n Comparisons , 1995, ISAAC.

[4]  C. A. R. Hoare Algorithm 63: partition , 1961, CACM.

[5]  J. IAN MUNRO,et al.  An Implicit Data Structure Supporting Insertion, Deletion, and Search in O(log² n) Time , 1986, J. Comput. Syst. Sci..

[6]  Jyrki Katajainen,et al.  Asymptotically efficient in-place merging , 2000, Theor. Comput. Sci..

[7]  Jukka Teuhola,et al.  Practical In-Place Mergesort , 1996, Nord. J. Comput..

[8]  Derick Wood,et al.  Implicit Selection , 1988, SWAT.

[9]  Ronald L. Rivest,et al.  Expected time bounds for selection , 1975, Commun. ACM.

[10]  Christos Levcopoulos,et al.  Exploiting Few Inversions When Sorting: Sequential and Parallel Algorithms , 1996, Theor. Comput. Sci..

[11]  C. A. R. Hoare,et al.  Algorithm 64: Quicksort , 1961, Commun. ACM.

[12]  Robert Sedgewick,et al.  The analysis of Quicksort programs , 1977, Acta Informatica.

[13]  Jyrki Katajainen,et al.  In-Place Sorting with Fewer Moves , 1999, Inf. Process. Lett..

[14]  Jyrki Katajainen,et al.  Stable minimum space partitioning in linear time , 1992, BIT.

[15]  J. Ian Munro,et al.  Average case selection , 1989, JACM.

[16]  Rajeev Motwani,et al.  Randomized algorithms , 1996, CSUR.

[17]  Manuel Blum,et al.  Time Bounds for Selection , 1973, J. Comput. Syst. Sci..

[18]  Arnold Schönhage,et al.  Finding the Median , 1976, J. Comput. Syst. Sci..