public static void Test_OP(int seed) { Console.WriteLine("---------------------------------------------"); Console.WriteLine("Test OP"); Stopwatch sw = new Stopwatch(); sw.Start(); MyDataArray myarray = new MyDataArray(n, seed); sw.Stop(); Console.WriteLine("Size of {0} count was initialized in => {1}", n, sw.Elapsed); Console.WriteLine("\nHeapsort started (timer on) \n"); sw.Start(); myarray.Print(n); Heapsort_OP.HeapSort(myarray, n); myarray.Print(n); sw.Stop(); Console.WriteLine("Test OP success "); Console.WriteLine("Size of {0} count array was sorted in => {1}", n, sw.Elapsed); Console.WriteLine("---------------------------------------------"); }
public static void AnalysisArray_List(int seed, int kiek) { int n = duomskc; Console.WriteLine("Array HeapSort"); Console.WriteLine("N RunTime"); for (int i = 0; i < kiek; i++) { MyDataArray myarr = new MyDataArray(n, seed); Stopwatch timer = new Stopwatch(); timer.Start(); Program.HeapSortArray.HeapSortas(myarr); timer.Stop(); //myarr.Print(n); Console.WriteLine("{0,-10}{1}", n, timer.Elapsed); n = n * 2; } Console.WriteLine(); n = duomskc; Console.WriteLine("List HeapSort"); Console.WriteLine("N RunTime"); for (int i = 0; i < kiek; i++) { MyDataList mylist = new MyDataList(n, seed); Stopwatch timer = new Stopwatch(); timer.Start(); Program.HeapSortList.HeapSortas(mylist); timer.Stop(); //mylist.Print(n); Console.WriteLine("{0,-10}{1}", n, timer.Elapsed); n = n * 2; } Console.WriteLine(); }
private static void Test_Performance(int seed) { Console.WriteLine("---------------------------------"); Console.WriteLine("Performance test"); int[] amount = { 100, 200, 400, 800, 1600, 3200, 6400, 12800 }; Console.WriteLine("Array Test"); foreach (var k in amount) { MyDataArray fileArray = new MyDataArray(k, seed); var watch = System.Diagnostics.Stopwatch.StartNew(); HeapSort(fileArray); watch.Stop(); Console.WriteLine("Number of elements: " + k + " Time: " + watch.Elapsed); } Console.WriteLine("List Test"); foreach (var k in amount) { MyDataList fileArray = new MyDataList(k, seed); var watch = System.Diagnostics.Stopwatch.StartNew(); HeapSort(fileArray); watch.Stop(); Console.WriteLine("Number of elements: " + k + " Time: " + watch.Elapsed); } }
public static void Test_OP(int seed, int n) { Stopwatch sw = new Stopwatch(); MyDataArray myarray = new MyDataArray(n, seed); sw.Start(); Heapsort_OP.HeapSort(myarray, n); sw.Stop(); Console.WriteLine("{1,9} took => {0}", sw.Elapsed, n); }
public static void Test_Array_List(int seed) { int n = 10; MyDataArray myarray = new MyDataArray(n, seed); Console.WriteLine("\n ARRAY \n"); myarray.Print(n); HeapSort(myarray); myarray.Print(n); MyDataList mylist = new MyDataList(n, seed); Console.WriteLine("\n LIST \n"); mylist.Print(n); HeapSort(mylist); mylist.Print(n); Test_Performance(seed); }
public static void TestArray_List(int seed) { int n = 12; MyDataArray myArray = new MyDataArray(n, seed); Console.WriteLine("---Array---"); myArray.Print(n); Console.WriteLine(); Console.WriteLine("---HeapSortedArray---"); HeapSortArray.HeapSortas(myArray); myArray.Print(n); Console.WriteLine(); MyDataList myList = new MyDataList(n, seed); Console.WriteLine("---List---"); myList.Print(n); Console.WriteLine(); Console.WriteLine("---HeapSortedList---"); HeapSortList.HeapSortas(myList); myList.Print(n); Console.WriteLine(); }