arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1403.6602cs.DSmath.PR
收藏

双枢轴快速排序中的枢轴抽样

Pivot Sampling in Dual-Pivot Quicksort

Markus E. Nebel, Sebastian Wild

摘要:

Vladimir Yaroslavskiy的新双枢轴快速排序-从版本7开始在Oracle的Java运行时库中使用-在其行为中具有有趣的不对称性。它们被证明会导致该算法的基本变体使用比经典单枢轴快速排序实现更少的比较。在本文中,我们扩展的分析的情况下,两个枢轴被选为固定顺序统计的随机样本,并给出精确的前导项的平均数的比较,交换和执行的Java字节码指令。事实证明,与经典的快速排序不同,选择枢轴作为样本的中位数是最佳的-Yaroslavskiy算法中的不对称性使具有系统偏斜的枢轴比对称选择更有效。此外,最佳偏斜在很大程度上取决于所采用的成本度量;最引人注目的是,像交换和比较的数量这样的抽象成本产生了与计数Java字节码指令非常不同的结果,可以假设它与实际运行时间最密切相关。

英文摘要:

The new dual-pivot Quicksort by Vladimir Yaroslavskiy - used in Oracle's Java runtime library since version 7 - features intriguing asymmetries in its behavior. They were shown to cause a basic variant of this algorithm to use less comparisons than classic single-pivot Quicksort implementations. In this paper, we extend the analysis to the case where the two pivots are chosen as fixed order statistics of a random sample and give the precise leading term of the average number of comparisons, swaps and executed Java Bytecode instructions. It turns out that - unlike for classic Quicksort, where it is optimal to choose the pivot as median of the sample - the asymmetries in Yaroslavskiy's algorithm render pivots with a systematic skew more efficient than the symmetric choice. Moreover, the optimal skew heavily depends on the employed cost measure; most strikingly, abstract costs like the number of swaps and comparisons yield a very different result than counting Java Bytecode instructions, which can be assumed most closely related to actual running time.

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

↑