Question: In java create a program to test and measure an actual running time of Insertion sort and Merge sort on your machine. Each sorting algorithm
In java create a program to test and measure an actual running time of Insertion sort and Merge sort on your machine. Each sorting algorithm must be a separate method:
a. Randomly generate 100 integers between 0 and 500.
b. Store those integers in an array and display them on screen.
c. Using each sorting algorithm, sort numbers and display the sorted numbers. The array must be passed as an argument to call a method.
d. For each sorting algorithm, measure an actual running time (millisecond or nanosecond) taken in sorting numbers on your machine and save the time in a temporary variable(s) or an array. The actual running time would be the elapsed time from start to end of sorting.
e. Repeat a d five times at least.
f. Display five running times measured for both sorting algorithms.
g. Calculate an average of the five running times for both and display them. h. All data display must appear in a tabular format.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
