我正在研究"timsort“算法,用于对相当大的数据集进行排序:http://timsort4net.codeplex.com/
通常我使用Array.Sort(Keys, Items),其中Items是一个整数数组,用作标识排序期间发生的位置更改的方法。
有没有办法在不大量修改排序算法的实现的情况下获得同样的结果?
发布于 2012-02-18 06:19:01
您可以使用在IList上定义的extension method
public static void TimSort<T>(this IList<T> array, Comparison<T> comparer, bool buffered = true)要对索引列表进行排序,并传入引用给定索引的真实对象的比较,请对它们进行比较并返回负值、正值或零值。
希望这能有所帮助!
https://stackoverflow.com/questions/9336188
复制相似问题