Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 a
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 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 quickSortElement int first, int last
if first last
Element pivotElement first
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started