gpt4 book ai didi

.net - .net在IComparer中使用了哪种排序算法

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:44:29 24 4
gpt4 key购买 nike

当我们在我们的类中实现 IComparer 时,有谁知道 .net 使用的是哪种排序算法?

最佳答案

QuickSort似乎是这样。

关于 IComparer 的文档说

This interface is used in conjunction with the Array.Sort and Array.BinarySearch methods.

Array.Sort文档说

This method uses the QuickSort algorithm. This implementation performs an unstable sort; that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal.

关于.net - .net在IComparer中使用了哪种排序算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/204805/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com