
Given an unordered array of $N$ elements drawn from a totally ordered set and an integer $k$ in the range from $1$ to $N$, in the classic selection problem the task is to find the $k$-th smallest element in the array. We study the complexity of this problem in the space-restricted random-access model: The input array is stored on read-only memory, and the algorithm has access to a limited amount of workspace. We prove that the linear-time prune-and-search algorithm---presented in most textbooks on algorithms---can be modified to use $��(N)$ bits instead of $��(N)$ words of extra space. Prior to our work, the best known algorithm by Frederickson could perform the task with $��(N)$ bits of extra space in $O(N \lg^{*} N)$ time. Our result separates the space-restricted random-access model and the multi-pass streaming model, since we can surpass the $��(N \lg^{*} N)$ lower bound known for the latter model. We also generalize our algorithm for the case when the size of the workspace is $��(S)$ bits, where $\lg^3{N} \leq S \leq N$. The running time of our generalized algorithm is $O(N \lg^{*}(N/S) + N (\lg N) / \lg{} S)$, slightly improving over the $O(N \lg^{*}(N (\lg N)/S) + N (\lg N) / \lg{} S)$ bound of Frederickson's algorithm. To obtain the improvements mentioned above, we developed a new data structure, called the wavelet stack, that we use for repeated pruning. We expect the wavelet stack to be a useful tool in other applications as well.
16 pages, 1 figure, Preliminary version appeared in COCOON-2013
FOS: Computer and information sciences, Data structures, Analysis of algorithms and problem complexity, wavelet stack, Models of computation (Turing machines, etc.), bit vector, multi-pass streaming, Computer Science - Data Structures and Algorithms, Data Structures and Algorithms (cs.DS), read-only memory, Searching and sorting, selection algorithm, random-access machine
FOS: Computer and information sciences, Data structures, Analysis of algorithms and problem complexity, wavelet stack, Models of computation (Turing machines, etc.), bit vector, multi-pass streaming, Computer Science - Data Structures and Algorithms, Data Structures and Algorithms (cs.DS), read-only memory, Searching and sorting, selection algorithm, random-access machine
| selected citations These citations are derived from selected sources. This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | 9 | |
| popularity This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network. | Average | |
| influence This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | Average | |
| impulse This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network. | Average |
