arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1811.01259cs.DS
收藏

QuickXsort --一种理论与实践上的快速排序方案

QuickXsort - A Fast Sorting Scheme in Theory and Practice

Stefan Edelkamp, Armin Weiß, Sebastian Wild

摘要:

QuickXsort是一种高效的就地顺序排序方案,它将Hoare的Quicksort算法与X混合在一起,其中X可以从更广泛的其他已知排序算法中选择,如Heapsort,Insertionsort和Mergesort。它的主要优点是QuickXsort可以在X没有的情况下就位。在这项工作中,我们提供了一般的转移定理表示的比较的QuickXsort的X的数量的比较。更具体地说,如果选择枢轴作为(不太快)增长大小样本的中位数,则QuickXsort和X的平均比较次数仅相差$o(n)$项。对于某些常数$k$的$k$的中值主元选择,差是一个线性项,我们精确计算其系数。例如,三个QuickMergesort的中位数最多使用$n \lg n - 0.8358n + O(\log n)$比较。此外,我们还研究了使用更少比较的其他算法对基本情况进行排序的可能性。通过这样做,比较的平均情况数量可以减少到$n \lg n- 1.4106n + o(n)$,剩余的间隙仅为$0.0321n$与已知下限的比较(同时总体上仅使用$O(\log n)$额外空间和$O(n \log n)$时间)。这些排序策略的实现表明,这些算法挑战了成熟的库实现,如Musser的Introsort。

英文摘要:

QuickXsort is a highly efficient in-place sequential sorting scheme that mixes Hoare's Quicksort algorithm with X, where X can be chosen from a wider range of other known sorting algorithms, like Heapsort, Insertionsort and Mergesort. Its major advantage is that QuickXsort can be in-place even if X is not. In this work we provide general transfer theorems expressing the number of comparisons of QuickXsort in terms of the number of comparisons of X. More specifically, if pivots are chosen as medians of (not too fast) growing size samples, the average number of comparisons of QuickXsort and X differ only by $o(n)$-terms. For median-of-$k$ pivot selection for some constant $k$, the difference is a linear term whose coefficient we compute precisely. For instance, median-of-three QuickMergesort uses at most $n \lg n - 0.8358n + O(\log n)$ comparisons. Furthermore, we examine the possibility of sorting base cases with some other algorithm using even less comparisons. By doing so the average-case number of comparisons can be reduced down to $n \lg n- 1.4106n + o(n)$ for a remaining gap of only $0.0321n$ comparisons to the known lower bound (while using only $O(\log n)$ additional space and $O(n \log n)$ time overall). Implementations of these sorting strategies show that the algorithms challenge well-established library implementations like Musser's Introsort.

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

↑