arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2404.04552cs.DS
收藏

利用部分信息的快速简单排序

Fast and Simple Sorting Using Partial Information

Bernhard Haeupler, Richard Hladík, John Iacono, Vaclav Rozhon, Robert Tarjan, Jakub Tětek

AI总结:

本文提出一种利用预先比较结果的确定性排序算法,结合拓扑排序、堆排序和有序搜索,以最优时间和比较次数解决排序及top-k排序问题。

摘要:

我们考虑在给定 m 个预先存在的比较结果的情况下对 n 个项目进行排序的问题。我们提出了一种简单且自然的确定性算法,其运行时间为 O(m+log T),并执行 O(log T) 次比较,其中 T 是与预先存在的比较结果一致的全序数量。我们的运行时间和比较次数界限在常数因子范围内是最优的,从而解决了一个自 1976 年以来被深入研究的问题(Fredman, Theoretical Computer Science)。此前在比较次数上达到 O(lg T) 界限的最佳算法,其时间界限为 O(n^{2.5}),且更为复杂。我们的算法结合了三种经典算法:拓扑排序、使用合适堆结构的堆排序,以及在有序列表中的高效搜索。它逐个按排序顺序输出项目。该算法可以修改为提前停止,从而解决重要且更一般的 top-k 排序问题:给定 k 以及一些预先存在的比较结果,按排序顺序输出最小的 k 个项目。修改后的算法在最小时间和比较次数内解决 top-k 排序问题,且差距在常数因子范围内。

英文摘要:

We consider the problem of sorting $n$ items, given the outcomes of $m$ pre-existing comparisons. We present a simple and natural deterministic algorithm that runs in $O(m+\log T)$ time and does $O(\log T)$ comparisons, where $T$ is the number of total orders consistent with the pre-existing comparisons. Our running time and comparison bounds are best possible up to constant factors, thus resolving a problem that has been studied intensely since 1976 (Fredman, Theoretical Computer Science). The best previous algorithm with a bound of $O(\lg T)$ on the number of comparisons has a time bound of $O(n^{2.5})$ and is more complicated. Our algorithm combines three classic algorithms: topological sort, heapsort with the right kind of heap, and efficient search in a sorted list. It outputs the items in sorted order one by one. It can be modified to stop early, thereby solving the important and more general top-$k$ sorting problem: Given $k$ and the outcomes of some pre-existing comparisons, output the smallest $k$ items in sorted order. The modified algorithm solves the top-$k$ sorting problem in minimum time and comparisons, to within constant factors.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑