Question: 2. Sorting algorithms Submit your answers here: https://canvas.uw.edu/courses/1199402/assignments/4254933 (a) Suppose we have a version of quick sort which selects pivots using the median-of-three strategy and

2. Sorting algorithms Submit your answers here: https://canvas.uw.edu/courses/1199402/assignments/4254933 (a) Suppose we have a version of quick sort which selects pivots using the median-of-three strategy and creates partitions in the manner described in lecture Explain how you would build an input array that would cause this version of quick sort to run in O (n2) time. Your answer should explain on a high level what your array would look like and what happens when you try running quick sort on it. You do not need to give a specific example of such a array, though you may if you think it will help make your explanation m ore clear (b) Recall that merge sort works by taking an array, splitting it into two pieces, recursively sorting both pieces, then combining both pieces in O (n) time. Suppose that instead we split the array into three equally sized pieces instead of two. After we finish recursing on each of the three pieces, we merge two of the three pieces together, then merge that with the third piece to get the final sorted result. What is the worst-case asymptotic runtime of this variation on merge sort? Is it better or worse then the original version of merge sort? Use the following steps to justify your answer: Write out the recurrence for this variation of Use the master theorem to give an asymptotic bound for this variation of merge sort Compare the bound from part b to that of a standard merge sort. merge sort
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
