Question: 2) (10 pts) Merge Sort vs Insertion Sort Running time analysis Modify code-Now that you have verified that your code runs correctly using the data.txt

 2) (10 pts) Merge Sort vs Insertion Sort Running time analysis

2) (10 pts) Merge Sort vs Insertion Sort Running time analysis Modify code-Now that you have verified that your code runs correctly using the data.txt input file, you can modify the code to collect running time data. Instead of reading arrays from the file data.txt and sorting, you will now generate arrays of size n containing random integer values from 0 to 10,000 to sort. Use the system clock to record the running times of each algorithm for ten different values of n for example: n = 5000, 10000, 15000, 20,000, 50,000. You may need to modify the values of n if an algorithm runs too fast or too slow to collect the running time data (do not collect times over a minute). Output to the terminal the array size n and time to sort. Name these new programs insertTime and mergeTime. In your write up submitted to Canvas explain how you modified your code to collect running times. Submit the code to TEACH

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!