public static void testD(int seed) { string filename = "@mydataarray.dat"; MyFileArray fileArray = new MyFileArray(filename, arrayLength, seed); using (fileArray.fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)) { Console.WriteLine("\n\n COUNTING SORT FILE ARRAY"); Console.WriteLine(longLine); fileArray.Print(arrayLength); Console.WriteLine(longLine); Sort(fileArray); fileArray.Print(arrayLength); } filename = "@mydatalist.dat"; MyFileList fileList = new MyFileList(filename, arrayLength, seed); using (fileList.fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)) { Console.WriteLine("\n\n COUNTING SORT FILE LIST "); Console.WriteLine(longLine); fileList.Print(arrayLength); Console.WriteLine(longLine); Sort(fileList); fileList.Print(arrayLength); } }
public static void testArrayTimes(int seed) { int[] numElementsArray = { 12800, 25600, 51200, 102400, 204800, 409600 }; foreach (int numberOfElements in numElementsArray) { Console.Write("\nElements: " + numberOfElements); MyDataArray dataArray = new MyDataArray(numberOfElements, seed); var watch = System.Diagnostics.Stopwatch.StartNew(); Sort(dataArray); watch.Stop(); Console.Write(" Data array time:" + watch.ElapsedMilliseconds); string filename = "@mydataarraytimes.dat"; MyFileArray fileArray = new MyFileArray(filename, numberOfElements, seed); using (fileArray.fs = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)) { watch = System.Diagnostics.Stopwatch.StartNew(); Sort(fileArray); watch.Stop(); Console.Write(" File array:" + watch.ElapsedMilliseconds); } } }