Question: 1 . In java Implement a method to sort a given array using the merge sort algorithm. You can use the algorithm provided ( see

1.In java Implement a method to sort a given array using the merge sort algorithm. You can use the
algorithm provided (see Page 2) instead of the algorithm from the textbook.
2. Write a driver program to test the merge sort algorithm for the arrays of varying lengths provided
in Canvas.
3. Compare the execution time of merge sort with insertion sort implemented in Lab-2. Make sure
you use the same array to compare the performance. Use a table or plot to summarize the results
and document your observations and analysis in the report.
4. Based on the performance results obtained in Problem-3, modify the merge sort algorithm such
that when the array size gets small enough, you would invoke insertion sort instead of invoking
merge sort (hint: you have to change the base condition in the recursion). Instead of hardcoding
the array size make it a variable that you can pass as an argument to the merge sort method and
test this cutoff value with at least four different values.
5. Test the program for the same array sizes and values. Compare the performance with the original
merge sort implementation, plot the execution times, and document the analysis in your lab
report

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!