排序算法为啥还一直在更新呢?不应该都已经探索出来了吗
基础的没啥变化,像希尔排序,快速排序,都是好几十年前定型了。但是实际工业界都是混用,不同case(比如待排数组的长度等)用不同的排序算法; 但是最common的主体都是快排。快排就牵扯到一个枢轴值的选取,怎么样选尽可能中间的,就又能玩出花来。 pdq的q也是指快排,但对一些特定情况做了处理和优化
https://rustwiki.org/zh-CN/rust-cookbook/algorithms/sorting.html
https://doc.rust-lang.org/std/vec/struct.Vec.html#method.sort_unstable
https://juejin.cn/post/6844904053353218062
https://github.com/orlp/pdqsort
https://github.com/zhangyunhao116
https://www.oschina.net/news/192497/go-will-use-pdqsort-in-next-release
https://docs.rs/pdqsort/latest/pdqsort/
https://mp.weixin.qq.com/s/cJJCtJw8IWWKcVZme7wVDw
也还有其他的混合排序算法:
http://www.diglog.com/story/1013898.html
https://github.com/scandum/blitsort ,看起来benchmark和稳定性都优于pdqsort
原文链接: https://dashen.tech/2010/03/28/pdqsort快速排序算法/
版权声明: 转载请注明出处.