Question: Consider the following modified merge sort algorithm. Note that the Merge procedure is identical to the one used in the Merge-Sort algorithm we discussed
Consider the following modified merge sort algorithm. Note that the Merge procedure is identical to the one used in the Merge-Sort algorithm we discussed in class. Modified-Merge-Sort (A, p, r) // Input: An array A[p..r] of n pair-wise comparable elements // Output: Array A[p..r] sorted in non-decreasing order 1 if p < r 2 3 4 5 6 7 8 mid1= p + (r - p)/3 mid2 P + 2* (r p)/3 Modified-Merge-Sort (A, p, mid1) Modified-Merge-Sort (A, mid1 + 1, mid2) Modified-Merge-Sort (A, mid2 + 1, r) Merge (A, p, mid1, mid2) Merge (A, p, mid2, r) = 1. (6pts) Perform Modified-Merge-Sort(A, 1, 9) on array A[1..9] = . List all the updated arrays after each Merge operation. 2. (3pts) Formulate a recurrence relation to describe the running time of algorithm Modified-Merge-Sort (A, p, r). Make sure to specify the base case(s). 3. (3pts) Solve the recurrence relation to give a tight bound (using 8) on the algorithm's running time.
Step by Step Solution
3.50 Rating (157 Votes )
There are 3 Steps involved in it
1 After performing ModifiedMergeSortA updated arrays after each Merge operation are Merge A 1 ... View full answer
Get step-by-step solutions from verified subject matter experts
