public static void Run(SortBase sorter, List <int> values = null, bool showDetail = true) { System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew(); Console.WriteLine("Sort type: " + sorter.GetType().Name + "\r\n"); SortBase list = sorter; if (values != null) { list.values = values; } Console.WriteLine("Unsorted Input List"); list.PrintLine(); Console.WriteLine("\r\nSorting...\r\n"); list.Sort(showDetail); Console.WriteLine("\r\nSorted Output List"); list.PrintLine(); double time = stopWatch.Elapsed.TotalMilliseconds; Console.WriteLine("\r\nTime taken: " + time + " milliseconds"); DashedLine(); Console.ReadKey(); }
public static void Run(int iteration = 200) { SortBase.Run(new SelectionSort(iteration), showDetail: false); }