In this paper, we investigate the following 1-d range reporting problem: preprocess an array A[1: n] of n elements so that, given a pair of indices i, j (1 <= i <= j <= n) and an integer k as query parameters, the k smallest elements of the sub-array A[i: j] can be reported efficiently. Brodal et al. [3] have shown that the problem can be solved in O(k) time after O(n log n) preprocessing in linear space. In this work, we obtain the only other possible trade-off. We reduce preprocessing time to O(n), but query time is O(k log k), again using linear space. Our method is very simple. Moreover, our algorithm reports or outputs the required elements in non-decreasing order one by one.
翻译:在本文中,我们调查了以下 1 - d 范围报告问题: 预处理 n 元素的 数组 A[ 1: n],这样, 以一对指数 i, j (1 ⁇ i ⁇ ⁇ j ⁇ n) 和整数 k 作为查询参数, 就可以有效地报告 A [ i: j] 子数组的 k 最小元素。 Brodal et al. [3] 已经表明, 问题可以在O (k) 时间之后的O (n log n) 线性空间预处理中解决。 在这项工作中, 我们得到了唯一的其他可能的交换。 我们把预处理时间缩短到 O( n), 但查询时间是 O (k log k), 也是使用线性空间。 我们的方法非常简单。 此外, 我们的算法报告或输出非声明顺序中所需的元素 逐一个输出 。