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 nd smallest element in array
of size rd smallest element for size etc.
a How many different possible solutions are there for an algorithm that
returns the index of the median of an array of size 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
