static void Main() { // CArray nums = new CArray(10); // Random rnd = new Random(100); // for(int i = 0; i < 10; i++) // nums.Insert((int)(rnd.NextDouble() * 100)); // nums.DisplayElements(); // Console.WriteLine("Before sorting: \n"); // nums.DisplayElements(); // Console.WriteLine("During sorting: \n"); // //nums.BubbleSort(); // //nums.SelectionSort(); // nums.InsertionSort(); // Console.WriteLine("After sorting: \n"); // nums.DisplayElements(); Timing sortTime = new Timing(); Random rnd = new Random(100); int numItems = 10000; CArray theArray = new CArray(numItems); for (int i = 0; i < numItems; i++) { theArray.Insert((int)(rnd.NextDouble() * 100)); } sortTime.startTime(); theArray.SelectionSort(); sortTime.stopTime(); Console.WriteLine("Time for Selection sort: " + sortTime.Result().TotalMilliseconds); theArray.Clear(); for (int i = 0; i < numItems; i++) { theArray.Insert((int)(rnd.NextDouble() * 100)); } sortTime.startTime(); theArray.BubbleSort(); sortTime.stopTime(); Console.WriteLine("Time for Bubble sort: " + sortTime.Result(). TotalMilliseconds); theArray.Clear(); for (int i = 0; i < numItems; i++) { theArray.Insert((int)(rnd.NextDouble() * 100)); } sortTime.startTime(); theArray.InsertionSort(); sortTime.stopTime(); Console.WriteLine("Time for Insertion sort: " + sortTime.Result(). TotalMilliseconds); }