Beispiel #1
0
 /// <summary>
 ///     Performs sort using Insertion Sort algorithm.
 ///     Performance:
 ///     Best:       O(n)
 ///     Worst:      O(n*n)
 ///     Average:    O(n*n)
 ///     In Place
 ///     Stable
 /// </summary>
 /// <typeparam name="T">Type contained in the collection</typeparam>
 /// <param name="options"></param>
 /// <param name="comparer">Lambda based comparer for type T</param>
 /// <returns></returns>
 public static SortOptions <T> UseInsertionSort <T>(this SortOptions <T> options, Func <T, T, int> comparer)
 {
     return(options.UseInsertionSort(new LambdaComparer <T>(comparer)));
 }
Beispiel #2
0
 /// <summary>
 ///     Performs sort using Insertion Sort algorithm.
 ///     Performance:
 ///     Best:       O(n)
 ///     Worst:      O(n*n)
 ///     Average:    O(n*n)
 ///     In Place
 ///     Stable
 /// </summary>
 /// <typeparam name="T">Type contained in the collection</typeparam>
 /// <typeparam name="TComparer">IComparer implementation for type T</typeparam>
 /// <param name="options"></param>
 /// <returns></returns>
 public static SortOptions <T> UseInsertionSort <T, TComparer>(this SortOptions <T> options)
     where TComparer : IComparer <T>, new()
 {
     return(options.UseInsertionSort(new TComparer()));
 }