Question
Consider the following variation of merge sort where the recursive calls are made only till the list is large; if the list is small, insertion
Consider the following variation of merge sort where the recursive calls are made only till the list is large; if the list is small, insertion sort is used is used to sort the list.
NewMergeSort(array A)
{
if A has L or fewer elements then InsetionSort(A) else
{
split A into Left and Right;
NewMergeSort(Left); NewMergeSort(Right); Merge Left and Right
}
}
What you have to do in this problem is to see what value of L gives the best results.
1. Consider at least the following values of L: 1, 2, 4, 8, 16, 32, 64.
2. Generate large random arrays (i.e. the values of the arrays are generated using a random number generator)
run NewMergeSort with different values of L and see which value of L yields the fastest result.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started