Skip to content
所有標籤

#median-of-medians

1 篇文章

Stanford CS161 Lecture 4:Median of Medians 如何保證線性 Selection

Selection 不必先排序。Median of medians 每 5 個元素取中位數,再取這些中位數的中位數作 pivot,保證較大的遞迴側至多 7n/10+5;用 substitution 可證 worst-case O(n)。