Question: how would you solve 4 a ? Part A ) Consider the general problem of finding the median of n entries. This time, it's also

how would you solve 4a?
Part A) Consider the general problem of finding the median of n entries.
This time, it's also OK to scramble the array items while searching.
We might attempt to adapt the basic idea in the Quicksort routine to solve
this problem. Explain how to change the quickSort() code on Page 160 to find
the median; of course, for full credit you should eliminate unnecessary work
wherever possible. For simplicity, YOU MAY ASSUME THAT n IS ODD (so that
the the definition of 'median' is unambiguous).
An overview of how your algorithm works is REQUIRED. You are not
required to provide specific pseudocode (however, you may wish to do so
anyway, if you are unsure whether your overview truly explains precisely
what you plan to do). 'Find the median' in this context means: write an
algorithm that will return the VALUE of the media
void quickSort(Element[]E, int first, int last)
if (first last)
Element pivotElement first
 how would you solve 4a? Part A) Consider the general problem

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!