Skip to main content
QUICK REVIEW

[论文解读] The Quicksort algorithm and related topics

Vasileios Iliopoulos|arXiv (Cornell University)|Mar 9, 2015
Algorithms and Data Compression参考文献 69被引用 4
一句话总结

本论文对快速排序算法及其变体进行了严格的数学分析,重点研究关键比较次数的方差以及多路枢轴的影响。通过生成函数和递推关系推导出方差的精确表达式,并探讨由随机图导出的随机偏序集中线性扩展的数量,为利用希尔排序进行链合并实现部分有序数据的高效排序提供了新的界和理论洞见。

ABSTRACT

Sorting algorithms have attracted a great deal of attention and study, as they have numerous applications to Mathematics, Computer Science and related fields. In this thesis, we first deal with the mathematical analysis of the Quicksort algorithm and its variants. Specifically, we study the time complexity of the algorithm and we provide a complete demonstration of the variance of the number of comparisons required, a known result but one whose detailed proof is not easy to read out of the literature. We also examine variants of Quicksort, where multiple pivots are chosen for the partitioning of the array. The rest of this work is dedicated to the analysis of finding the true order by further pairwise comparisons when a partial order compatible with the true order is given in advance. We discuss a number of cases where the partially ordered sets arise at random. To this end, we employ results from Graph and Information Theory. Finally, we obtain an alternative bound on the number of linear extensions when the partially ordered set arises from a random graph, and discuss the possible application of Shellsort in merging chains.

研究动机与目标

  • 提供快速排序算法中比较次数方差的完整、详细的推导,该结果虽常被引用,但在文献中却很少有完整证明。
  • 分析使用多个枢轴的快速排序变体(包括双枢轴和多键分区)的性能,并推导其统计特性,如方差和比较次数的分布。
  • 研究由随机图导出的随机偏序集中线性扩展的数量,提供新的界和理论洞见。
  • 探讨希尔排序在部分有序数据结构中用于链合并的应用,特别是当线性扩展数量为超线性时。

提出的方法

  • 使用生成函数和递推关系推导快速排序中关键比较的方差,重点关注双枢轴和多枢轴分区方案。
  • 应用生成函数方法,求解涉及调和数 $ H_n $ 和广义调和数 $ H_n^{(2)} $ 的二阶递推关系。
  • 利用范德蒙德矩阵推导多键分区分析中的积分常数,从而获得比较次数的精确解。
  • 运用图论和信息论工具建模随机偏序集,特别是随机图序,分析其结构特性(如高度和线性扩展数)。
  • 基于加性参数和偏序集分解技术,提出随机图序的期望线性扩展数的新界。
  • 基于理论性能界,提出希尔排序作为部分有序集中链合并的替代策略,尤其在期望线性扩展数为超线性时。

实验结果

研究问题

  • RQ1双枢轴快速排序中比较次数的精确方差是多少?能否从第一原理出发严格推导?
  • RQ2多枢轴快速排序变体(如三数取中或重样本分区)如何影响比较次数的分布和矩?
  • RQ3由随机图导出的随机偏序集中,线性扩展的期望数量是多少?其随元素数量如何变化?
  • RQ4随机图序的高度在渐近意义上如何表现?其期望值可建立怎样的界?
  • RQ5希尔排序能否有效用于部分有序集中链的合并?在何种条件下其性能优于其他合并策略?

主要发现

  • 双枢轴快速排序中比较次数的方差被推导为 $ f_n''(1) = 4(n+1)^2(H_{n+1}^2 - H_{n+1}^{(2)}) - 4H_{n+1}(n+1)(4n+3) + 23n^2 + 33n + 12 $,其中 $ H_n $ 和 $ H_n^{(2)} $ 分别为调和数和广义调和数。
  • 建立了比较次数二阶矩的递推关系,其二阶差分方程简化为 $ \Delta^2 \binom{n}{2}f_n''(1) = 12(n+1)(n+2)(H_n^2 - H_n^{(2)}) - H_n(20n^2 + 32n - 12) + 17n^2 + 37n + 3 $。
  • 基于加性参数和偏序集分解技术,推导出随机图序的期望线性扩展数的替代界,优于先前估计。
  • 随机图序的期望高度有界,分析表明在许多情况下线性扩展数呈超线性增长,从而支持使用希尔排序进行链合并。
  • 将归并排序应用于部分有序集时,时间复杂度为 $ (1+\epsilon)\log_2(e(P)) + O(n) $,当 $ \log_2(e(P)) $ 为超线性时,提出希尔排序作为可行的替代方案。
  • 分析证实,具有 $ k $ 条链(链大小为 $ m_1, \dots, m_k $)的部分有序集中,逆序数的上界为 $ \binom{n}{2} - \sum_{j=1}^k \binom{m_j}{2} $,且在最坏链排序下该界是紧的。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。