Question: Exercise 5 . Variations on MergeSort a ) We want to try a variation on MergeSort called MergeSort 3 , with splits up the input

Exercise 5. Variations on MergeSort
a) We want to try a variation on MergeSort called MergeSort3, with splits up the input array into 3 subarrays of length n3(or close to it), makes recursive calls to sort them, and then does a 3-way merge from Homework 4.
Write the recurrence equation for MergeSort3, and show a call tree for it. Obtain a solution for this recurrence equation, using your favorite method.
b) Generalize your work above to MergeSortK, which splits up the array into k subarrays of length nk, where k2. Note that when k=2 we get regular MergeSort and when k=3 we get MergeSort 3.
c) We now have a variation on MergeSort called SillySort which splits up the input array into 2 subarrays of length 23n rather than 12n.(During the Merge, any duplicate elements are removed.) Write the recurrence equation for MergeSort3, and show a call tree for it. Obtain a solution for this recurrence equation, using your favorite method.
d) Generalize your work above to SillySortK, which uses 2 subarrays of length n**k-1k rather than 12n, where k2. Note that when k=2 we get regular MergeSort and when k=3 we get SillySort
Exercise 5 . Variations on MergeSort a ) We want

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 Programming Questions!