Question: [35 points] Collaborative Problem -CLRS 2-1: Although merge sort runs in e(mg)ve it faster in practice insertion sort runs in e(n2) worst-case time, the constant
[35 points] Collaborative Problem -CLRS 2-1: Although merge sort runs in e(mg)ve it faster in practice insertion sort runs in e(n2) worst-case time, the constant factors in in for small problem sizes on many machines. Thus, it makes sense to coarsen the leaves of the recuri using insertion sort within merge sort when subproblems become sufficiently small. Consider a modificatio to merge sort in which n/k sublists of length k are sorted using insertion sort and then merged usin standard merging mechanism, where k is a value to be determined. onstant factors in insertion sort can make it faster in practice (a) [10 points] Prove that insertion sort can sort the n/k sublists, each of length k, in e(nk) worst-case time (b) [10 points] Prove how to merge the sublists in e(nlg (n/k)) worst-case time. (c) [10 points] Given that the modified algorithm runs in e(nk + nlg(n/k) ) worst-case time, what is the as the same running time as largest value of k as a function of n for which the modified algorithm h standard merge sort, in terms of -notation? (d) [5 points] How should we choose k in practice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
