예제 #1
0
 /// <summary>
 ///     Performs sort using Shell 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">Comparer for type T</param>
 /// <returns></returns>
 public static SortOptions <T> UseShellSort <T>(this SortOptions <T> options, IComparer <T> comparer)
 {
     return(options.UseShellSort(comparer, collection => collection.Count / 2));
 }
예제 #2
0
 /// <summary>
 ///     Performs sort using Shell 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>
 /// <param name="incrementFactory">Factory function for calculating custom Increment Step to optimize sorting</param>
 /// <returns></returns>
 public static SortOptions <T> UseShellSort <T>(this SortOptions <T> options, Func <T, T, int> comparer, Func <IList <T>, int> incrementFactory)
 {
     return(options.UseShellSort(new LambdaComparer <T>(comparer), incrementFactory));
 }
예제 #3
0
 /// <summary>
 ///     Performs sort using Shell 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>
 /// <param name="incrementFactory">Factory function for calculating custom Increment Step to optimize sorting</param>
 /// <returns></returns>
 public static SortOptions <T> UseShellSort <T, TComparer>(this SortOptions <T> options, Func <IList <T>, int> incrementFactory)
     where TComparer : IComparer <T>, new()
 {
     return(options.UseShellSort(new TComparer(), incrementFactory));
 }
예제 #4
0
 /// <summary>
 ///     Performs sort using Shell 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> UseShellSort <T>(this SortOptions <T> options, Func <T, T, int> comparer)
 {
     return(options.UseShellSort(new LambdaComparer <T>(comparer), collection => collection.Count / 2));
 }
예제 #5
0
 /// <summary>
 ///     Performs sort using Shell 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> UseShellSort <T, TComparer>(this SortOptions <T> options)
     where TComparer : IComparer <T>, new()
 {
     return(options.UseShellSort(new TComparer(), collection => collection.Count / 2));
 }