static void Main(string[] args) { InsertionSortAlgorithm insertionSortAlgorithm = new InsertionSortAlgorithm(); insertionSortAlgorithm.Array = new int[] { 3, 5, 1, 93, 6, 32, 1, 0 }; insertionSortAlgorithm.InsertionSort(); foreach (int x in insertionSortAlgorithm.Array) { Console.WriteLine(x); } Console.ReadLine(); }
/// <summary> /// Sorts list using Insertion sort algorithm and given comparer. /// </summary> /// <param name="target">Target.</param> /// <param name="comparer">Comparer.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public static void InsertionSort <T> (this IList <T> target, IComparer <T> comparer) { InsertionSortAlgorithm.InsertionSort(target, comparer); }