문제

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