QuickMergesort:实用高效的常数因子最优排序
QuickMergesort: Practically Efficient Constant-Factor Optimal Sorting
摘要:
我们认为内部排序的$n$元素序列的基本问题。在其最佳理论设置QuickMergesort中,QuickSort与Mergesort的组合以及$\sqrt{n}$的中位数枢轴选择,平均最多需要$n \log n - 1.3999n + o(n)$元素比较。本文解决的问题是如何使该算法实用。由于精细的枢轴选择通常会增加很多开销,我们发现QuickMergesort的中位数3枢轴选择导致平均最多$n \log n - 0{.}75n + o(n)$元素比较,同时在基本数据上运行速度很快。实验表明,QuickMergesort优于最先进的库实现,包括C++的Introsort和Java的Dual-Pivot Quicksort。进一步权衡低运行时间和低数量的比较进行了研究。此外,我们描述了一个实际有效的版本与$n \log n + O(n)$比较在最坏的情况下。
英文摘要:
We consider the fundamental problem of internally sorting a sequence of $n$ elements. In its best theoretical setting QuickMergesort, a combination Quicksort with Mergesort with a Median-of-$\sqrt{n}$ pivot selection, requires at most $n \log n - 1.3999n + o(n)$ element comparisons on the average. The questions addressed in this paper is how to make this algorithm practical. As refined pivot selection usually adds much overhead, we show that the Median-of-3 pivot selection of QuickMergesort leads to at most $n \log n - 0{.}75n + o(n)$ element comparisons on average, while running fast on elementary data. The experiments show that QuickMergesort outperforms state-of-the-art library implementations, including C++'s Introsort and Java's Dual-Pivot Quicksort. Further trade-offs between a low running time and a low number of comparisons are studied. Moreover, we describe a practically efficient version with $n \log n + O(n)$ comparisons in the worst case.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。