To learn about and analyze various sorting algorithms.
For this project you are going to write several new functions called: SelectionSort, InsertionSort, MergeSort, and QuickSort. Each function should take an array of integers (and any other parameters you choose) and each function should sort the array using the appropriate sorting algorithm. Once you have the functions written and working correctly, run some tests to determine how long it takes the algorithms to sort arrays of various sizes. Start with arrays of 20000 elements. Continue to double this amount until you reach 640,000 elements. Call the clock() function before and after each sort to determine the total amount of elapsed time required for each sort (this will give you time in milliseconds).
You can save yourself some time and trouble by writing a procedure to create dynamic arrays of various sizes filled with random values. You can also statically declare an array with all of the sizes that you need already declared (from 20000 to 640000). Try to come up with several functions to make your life easier here, like both a runAllTests and a runTest where you pass it in the size. I'd like you to run the test at least 3 times with each array size and take the average of those times.
MAKE SURE YOU DELETE ARRAYS ONCE THEY ARE NOT NEEDED! Why would you need to do this?
You should save test results to text files for easy reference. The files don't have to be complex, each line should just say something like:
Insertion Sort: 20000 elements across 3 consecutive tests took on average 2263 milliseconds
While the library class stopwatch I gave you is in seconds, I'd like for it to be expressed as milliseconds and with no remainder. When you are finished with the tests, prepare a short single document report that describes your results. The document should contain a line graph prepared with Microsoft Excel showing the times required for each sort with each algorithm. For easy comparison, also put all results into one graph. Write a few paragraphs explaining what you think the results mean. Did sorts take as long as you thought they would? Add as an appendix a copy of all your test files.