Question: Answer the following questions about estimating the minimum complexity for an algorithm that calculates the median of an array. You may assume that the array

Answer the following questions about estimating the minimum complexity
for an algorithm that calculates the median of an array. You may assume
that the array has odd size, and in an array with odd size, the median
will be the middle element in sorted order (2nd smallest element in array
of size 3,3rd smallest element for size 5, etc.).
(a) How many different possible solutions are there for an algorithm that
returns the index of the median of an array of size n? Note that you
only need to count the distinct solutions to this problem (different
problem instances may share the same solution). Briefly justify your
answer.
(b) What is the minimum number of comparisons that a comparison-
based median algorithm would need to make in order to produce all
of these solutions? Justify your answer.
 Answer the following questions about estimating the minimum complexity for an

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!