Question: Problem 5 (15 points) Consider a sorting algorithm that combines merge sort and insertionso algorithm. We still use divide and conquer like merge sort, however

 Problem 5 (15 points) Consider a sorting algorithm that combines merge

Problem 5 (15 points) Consider a sorting algorithm that combines merge sort and insertionso algorithm. We still use divide and conquer like merge sort, however when the number of elements in an array is at most k elements (k is a parameter), we stop dividing the clements as t regular merge sort, instead, we call the insertion sort. Assuming we have defined the following two procedures: insertion-sort(Alp q) which sort the subarray Alp 4 merge(Alp.q.r) which merges the sorted subarray Alp-r) and Ar 1q Try to write the pseudo code for this algorithm: given array Alp-q1 and a parameter ka 1. mentioned above merge-insert(Alp q). k) 2. For an input array of size n, how many times will the insertion be called by the modified merge? In the worst case, what is the total time for these insertion sort? worst case? Justity your answer 3. What is the running time of merge-insert in the

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!