Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 - 1 Insertion sort on small arrays in merge sort Although merge sort runs in ( n l g n ) worst - case
Insertion sort on small arrays in merge sort
Although merge sort runs in worstcase time and insertion sort
runs in worstcase time, the constant factors in insertion sort can
make it faster in practice for small problem sizes on many machines.
Thus it makes sense to coarsen the leaves of the recursion by using
insertion sort within merge sort when subproblems become sufficiently
small. Consider a modification to merge sort in which sublists of
length are sorted using insertion sort and then merged using the
standard merging mechanism, where is a value to be determined.
a Show that insertion sort can sort the sublists, each of length in
worstcase time.
b Show how to merge the sublists in worstcase time.
c Given that the modified algorithm runs in worst
case time, what is the largest value of as a function of for which
the modified algorithm has the same running time as standard merge
sort, in terms of notation?
d How should you choose in practice?
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