private static void BubbleSortTest() { Console.WriteLine("Bubble Sort Test:"); int[] arr = new int[_arr.Length]; Array.Copy(_arr, arr, _arr.Length); ISortAble bubbleSort = new BubbleSort(); bubbleSort.StartTimer(); int[] sorted = bubbleSort.Sort(arr); bubbleSort.StopTimer(); if (_printArray) { bubbleSort.PrintArray(sorted); } bubbleSort.PrintElapsedTime(); bubbleSort.ResetTimer(); }
static void Main(string[] args) { int[] array = { 5, 12, 1, 88, 21, 42, 2 }; //SelectionSort sort = new SelectionSort(array); BubbleSort sort = new BubbleSort(array); //print out array before sorting sort.PrintArray(array); sort.Sort(); sort.PrintArray(array); // Keep the console window open in debug mode. Console.WriteLine("\nPress any key to exit."); Console.ReadKey(); }