Question: USE JAVA 7. [2 bonus marks*] Write a program that generates an array A of n random integers, and sorts A using Insertion-Sort, Quicksort and

USE JAVA USE JAVA 7. [2 bonus marks*] Write a program that generates an

7. [2 bonus marks*] Write a program that generates an array A of n random integers, and sorts A using Insertion-Sort, Quicksort and Merge-sort. Run your program with arrays of size n = 8, 16, 32, 64, ..., 220. Keep track of the CPU time each algorithm takes to sort each of these arrays. Comment on the running times you obtained, and compare them to the complexities as discussed in class. Hint: place the CPU times you obtained on a table or a plot (or both) to interpret the results. 8. [2 bonus marks] Implement the recursive algorithm that reverses an array, and run it on the sorted lists of Insertion-Sort, Quicksort and Merge-sort. The output should be lists sorted in decreasing order. * max 2 bonus marks for this assignment

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!