Answered step by step
Verified Expert Solution
Link Copied!

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 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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions