知识卡片
快排先定位枢轴再递归
快速排序先原地分区,使枢轴左侧元素≤枢轴、右侧≥枢轴,再递归排序两侧;枢轴已经位于最终位置,无需合并。每层分区耗时 Θ(n),总时间由枢轴造成的两侧规模决定。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第7章 快速排序 · 查看原书依据
Combine by doing nothing: because the two subarrays are already sorted, no work is needed to combine them.
参考来源
- 位置:《算法导论(第4版)》第 7 章 7.1–7.3 节(`OEBPS/chapter007.xhtml`,文本字符 [0, 5000);图 7.1–7.5)。
- 结论依据:7.1 节按分治步骤先让 PARTITION 返回枢轴位置 q,再只递归 A[p:q−1] 与 A[q+1:r];两侧已有序后无需合并。
- 原始内容:Combine by doing nothing: because the two subarrays are already sorted, no work is needed to combine them.