Bubble Sort
1. Implement a bubble sort in C# with Visual Studio using arrays. The algorithm for the bubble sort is shown in listing 1.
2. The bubble sort should sort an array of randomly assigned integers.
3. Sort a random list of elements of 100, 1,000, 10,000, 25,000, 50,000, 100,000, 250,000, 500,000, 750,000, and 1,000,000 elements, respectively and the time it takes (in milliseconds) to complete each sorting operation.
4. Graph the results in Excel using a single graph.
5. Repeat steps 3 and 4 above, but instead of using the Bubble Sort algorithm, use the language supplied sort method to sort the arrays. Graph your results using a second Excel graph.
6. Complete Programming Assignments require a Design & Testing DocumentCSCI312 – Searching and Sorting Bubble Sort 1. Implement a bubble sort in C++, Java, C#, or VB.NET using arrays. The algorithm for the bubble sort is shown in listing 1. 2. The bubble sort should sort an array of randomly assigned integers. 3. Sort a random list of elements of 100, 1,000, 10,000, 25,000, 50,000, 100,000, 250,000, 500,000, 750,000, and 1,000,000 elements, respectively and the time it takes (in milliseconds) to complete each sorting operation. 4. Graph the results in Excel using a single graph. procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i = 1 to n-1 inclusive do if A[i-1] > A[i] then swap(A[i-1], A[i]) swapped = true end if end for n = n - 1 until not swapped end procedure Listing 1 5. Repeat steps 3 and 4 above, but instead of using the Bubble Sort algorithm, use the language supplied sort method to sort the arrays. Graph your results using a second Excel graph. NOTE: C++ programmers, please review the programmer’s note on the following page for important details regarding allocating memory for large arrays. When you are finished, upload your completed graph(s) (as an Excel document) and your source code for your project to Blackboard. No testing or design document is required for this lab assignment. C++ Programmer’s Note Large arrays must be dynamically allocated using the new operator (and conversely, must be deallocated using the delete operator. Attempting to make a large array using the automatic memory allocation will fail. int a[500000]; // FAIL - Not enough memory on the heap... // Workaround is to manually allocate memory int *list = new int[500000]; // TO DO: // Manually allocate an array work with the array here delete [] list; // free memory manually allocated list = NULL; // set to NULL to prevent accidental use after freed Time Calculations C# DateTime start = DateTime.Now; DateTime end; // TO DO: Insert code to time here... end = DateTime.Now; TimeSpan ts = end.Subtract(start); Console.WriteLine("Duration = {0} ms", ts.TotalMilliseconds); Java long start = System.currentTimeMillis(); long end = 0; long total = 0; // TO DO: Insert code to time here... end = System.currentTimeMillis(); total = end - start; String s = String.format("Duration = %d ms", total ); System.out.println(s); C++ SYSTEMTIME sysTimeStart, sysTimeEnd; // include to use the time functions ZeroMemory(&sysTimeStart, sizeof(SYSTEMTIME)); ZeroMemory(&sysTimeEnd, sizeof(SYSTEMTIME)); GetSystemTime(&sysTimeStart); // TO DO: Insert code to time here... GetSystemTime(&sysTimeEnd); long start = (sysTimeStart.