Вопрос

I was looking into the "timsort" algorithm for doing some sorting on my fairly large data sets: http://timsort4net.codeplex.com/

Typically I use Array.Sort(Keys, Items) where Items is an integer array that serves as a method to identify the position changes that occurred during the sort.

Is there any way to acheive this same result without having to heavily modify the implementation of the sorting algorithm?

Это было полезно?

Решение

You could use the extension method defined on IList

public static void TimSort<T>(this IList<T> array, Comparison<T> comparer, bool buffered = true)

to sort the list of indices, and pass in a Comparison that references the real objects given the indices, compares them and returns negative, positive or zero values.

Hope this helps!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top