Question: 5. Consider the merge sort routine presented in lecture and in the notes. Consider now a modification to merge sort in which nlk sublists of

5. Consider the merge sort routine presented in lecture and in the notes. Consider now a modification to merge sort in which nlk sublists of length k are sorted using insertion sort and then merged using the standard merging mechanism. (This concept was discussed in a homework problem.) Determine a permutation of the input list (1, 2, 3, 4, 5, 6, 7, 8) which will result in a worst case for this hybrid routine, where cost is measured solely in terms of number of comparisons made between elements from the input list. In this example assume k= 4. How many comparisons are made? ANSWER: input list, for example, (8, 6, 4, 2,7,5,3,1) (5 points) ANSWER: number of comparisons made = __ _19c__ (5 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
