線性找中位數的演算法:Quickselect + Median of Medians
上禮拜看到「My Favorite Algorithm: Linear Time Median Finding (2018) (rcoh.me)」這篇,原文是 2018 的文章「My Favorite Algorithm: Linear Time Median Finding」。
找中位數最直覺的想法是排序後直接拉出來,這樣的
#Computer #Murmuring #Programming #algorithm #median #medians #quickselect
線性找中位數的演算法:Quickselect + Median of Medians
上禮拜看到「My Favorite Algorithm: Linear Time Median Finding (2018) (rcoh.me)」這篇,原文是 2018 的文章「My Favorite Algorithm: Linear Time Median Finding」。 找中位數最直覺的想法是排序後直接拉出來,這樣的演算法在最差情況下可以做到 。 不過這個問題有 Quickselect + Median of medians 的組合技,可以達到最差情況下仍然有線性時間解 。 記得是演算法的經典教科...