public static void Test_Array_OP(int seed) { Console.WriteLine("\n Operatyvioji atmintis: \n"); int n = 12; Console.WriteLine("\n Selection sort ARRAY: \n"); MyDataArray myArray = new MyDataArray(n); myArray.Print(n); myArray.SelectionSort(); myArray.Print(n); Console.WriteLine("\n Quick sort ARRAY: \n"); MyDataArray myArray2 = new MyDataArray(n); myArray2.Print(n); myArray2.QuickSort(); myArray2.Print(n); Console.WriteLine(); Console.WriteLine("------------------------------------------------------------"); }
public static void OP_Sort_Speed_Test() { Console.WriteLine(); Console.WriteLine(" Speed test OP: "); Console.WriteLine("\n Selection sort ARRAY: \n"); int[] length = { 400, 800, 1600, 3200, 6400, 12800, 25600 }; for (int i = 0; i < length.Length; i++) { MyDataArray n = new MyDataArray(length[i]); Stopwatch t = new Stopwatch(); t.Start(); n.SelectionSort(); t.Stop(); TimeSpan e = t.Elapsed; Console.WriteLine("Amount of data: {0,5} --->>> Time elapsed: {1}", length[i], e.ToString()); } Console.WriteLine(); Console.WriteLine("\n Selection sort LIST: \n"); for (int i = 0; i < length.Length; i++) { MyDataList n = new MyDataList(length[i]); Stopwatch t = new Stopwatch(); t.Start(); n.SelectionSort(); t.Stop(); TimeSpan e = t.Elapsed; Console.WriteLine("Amount of data: {0,5} --->>> Time elapsed: {1}", length[i], e.ToString()); } Console.WriteLine(); Console.WriteLine("------------------------------------------------------------"); Console.WriteLine("\n Quick sort ARRAY: \n"); for (int i = 0; i < length.Length; i++) { MyDataArray n = new MyDataArray(length[i]); Stopwatch t = new Stopwatch(); t.Start(); n.QuickSort(); t.Stop(); TimeSpan e = t.Elapsed; Console.WriteLine("Amount of data: {0,5} --->>> Time elapsed: {1}", length[i], e.ToString()); } Console.WriteLine(); Console.WriteLine("\n Quick sort LIST: \n"); for (int i = 0; i < length.Length; i++) { MyDataList n = new MyDataList(length[i]); Stopwatch t = new Stopwatch(); t.Start(); n.QuickSort(n, 0, n.Length - 1); t.Stop(); TimeSpan e = t.Elapsed; Console.WriteLine("Amount of data: {0,5} --->>> Time elapsed: {1}", length[i], e.ToString()); } Console.WriteLine("____________________________________________________________"); Console.WriteLine("____________________________________________________________"); }