Reference no: EM133816563
Assignment: Algorithm Project
Write a Java program that compares standard MergeSort with the Hybrid MergeSort (MergeSort with Insertion Sort for smaller arrays). You need to do the following:
1. Create an integer array as big as your Java/RAM allows you. That is, create the largest array possible in your computer.
2. Fill this array using Random integer values, use Java Random number generator.
3. Implement Hybrid MergeSort that uses InsertionSort when the array gets smaller than some size, say ‘s'.
4. Run Hybrid MergeSort for various values of ‘s' and calculate the time it takes for the algorithm to finish.
5. Plot a graph where x-axis has the value of ‘s' and y-axis has the time it took to finish sorting.
6. Note that you should run various values of ‘s' evenly spaced from 1 to N. Here N is the size of the entire array. Note also that when ‘s'=1, it represents pure MergeSort, and when ‘s'=N it represents pure InsertionSort.