重新审视运行一代:上升的可能性或不可能下降
Run Generation Revisited: What Goes Up May or May Not Come Down
摘要:
在本文中,我们重温了经典的运行生成问题。游程生成是外部内存排序的第一阶段,目标是扫描数据,使用大小为M的小缓冲区对元素进行重新排序,并输出尽可能长的游程(连续排序的元素块)。我们开发的算法,最大限度地减少运行的总数(或等效地,最大化的平均运行长度)时,运行被允许排序或反向排序。我们研究的问题,在在线设置,无论有和没有资源增加,并在离线设置。(1)我们分析交替向上向下替换选择(排序和反向排序之间的交替运行),这是高德纳早在1963年就研究过的。我们证明了这个简单的策略是渐近最优的。具体来说,我们表明,交替上下替换选择是2-竞争,没有确定性的在线算法可以执行得更好。(2)我们给在线算法具有较小的竞争比与资源增强。具体来说,我们展示了一个确定性算法,当给定一个大小为4 M的缓冲区时,它能够匹配或击败任何具有大小为M的缓冲区的最佳算法。此外,我们提出了一个随机在线算法,这是7/4竞争时,给定的缓冲区的两倍,最佳的。(3)我们证明,性能也可以提高少量的远见。我们给出了一个算法,这是3/2竞争,与输入流的未来3 M元素的预知。对于极端的情况下,所有未来的元素是已知的,我们设计了一个PTAS计算运行生成算法必须遵循的最佳策略。(4)最后,我们提出了适合近排序的输入,保证有足够长的运行最优解的算法。
英文摘要:
In this paper, we revisit the classic problem of run generation. Run generation is the first phase of external-memory sorting, where the objective is to scan through the data, reorder elements using a small buffer of size M , and output runs (contiguously sorted chunks of elements) that are as long as possible. We develop algorithms for minimizing the total number of runs (or equivalently, maximizing the average run length) when the runs are allowed to be sorted or reverse sorted. We study the problem in the online setting, both with and without resource augmentation, and in the offline setting. (1) We analyze alternating-up-down replacement selection (runs alternate between sorted and reverse sorted), which was studied by Knuth as far back as 1963. We show that this simple policy is asymptotically optimal. Specifically, we show that alternating-up-down replacement selection is 2-competitive and no deterministic online algorithm can perform better. (2) We give online algorithms having smaller competitive ratios with resource augmentation. Specifically, we exhibit a deterministic algorithm that, when given a buffer of size 4M , is able to match or beat any optimal algorithm having a buffer of size M . Furthermore, we present a randomized online algorithm which is 7/4-competitive when given a buffer twice that of the optimal. (3) We demonstrate that performance can also be improved with a small amount of foresight. We give an algorithm, which is 3/2-competitive, with foreknowledge of the next 3M elements of the input stream. For the extreme case where all future elements are known, we design a PTAS for computing the optimal strategy a run generation algorithm must follow. (4) Finally, we present algorithms tailored for nearly sorted inputs which are guaranteed to have optimal solutions with sufficiently long runs.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。