示例#1
0
 /// <summary>
 /// Sorts the specified list using an insertion sort algorithm and the specified comparer.
 /// </summary>
 /// <remarks>
 /// Insertion sort is a O(n²) time complexity algorithm and should not be used on arbitrary lists.
 /// However, it has a best case time complexity of O(n) for lists that are already sorted and is quite fast when used on nearly sorted input.
 /// </remarks>
 public static void InsertionSort <T>(this IList <T> ts, IComparer <T> comparer)
 {
     InsertionSort(ts, Comparisons <T> .ToComparison(comparer));
 }