知识卡片
并行归并选较长数组中点为枢轴
取较长有序子数组的中间元素为枢轴,再在较短数组中二分定位分割点。这样两个子任务分别归并枢轴两侧,且即使另一数组分割很偏,最大子任务也不超过原规模的四分之三。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第26章 并行算法 · 查看原书依据
Specifically, the recursive merging algorithm picks the pivot x as the middle element of the larger of the two input subarrays, which we can assume without loss of generality is A[p1 : r1], since otherwise, the two subarrays can just switch roles.
参考来源
- 位置:《算法导论(第4版)》第26章《并行算法》(OEBPS/chapter026.xhtml,文本字符[65000,70000))。
- 结论依据:第26章 P-MERGE-AUX:取较长有序子数组中点 x=A[q₁],在较短数组求 split point q₂;即使较短数组分割偏斜,两递归归并各至少分得原规模 1/4,最大子问题至多 3/4。
- 原始内容:Specifically, the recursive merging algorithm picks the pivot x as the middle element of the larger of the two input subarrays, which we can assume without loss of generality is A [ p 1 : r 1 ], since otherwise, the two subarrays can just switch roles.
- 分支规模旁证(文本字符[65000,70000)):As we’ll see when we get to the analysis, even if x splits A [ p 2 : r 2 ] badly— x is either smaller than all the subarray elements or larger—we’ll still have at least 1/4 of the elements in each of the two recursive merges. Thus the larger of the recursive merges operates on at most 3/4 elements,