Question: ( 1 0 points ) Given a set of n numbers, we wish to obtain the i largest in sorted order, for i a small

(10 points) Given a set of n numbers, we wish to obtain the i largest in sorted order, for i a small constant. That
is, i does not grow when n grows. Consider the following algorithm: Use Select(L,k) from the slide set to find
the ith largest value, partition the list around this value using Partition from QuickSort, and then sort the i values
in the left right set of the partition. Answer the following:
(a) Describe a worst case data set, and say why it is the worst. An example for a particular value of n and i will
receive partial credit. For full credit, you need to describe the data set in terms of n for a small arbitrary
constant i, which you may not fix to be a specific value. For example, a worst case data set of size n for
QuickSort is one that is already sorted.
(b) What is the worst case order complexity of the algorithm described; that is, what is the order complexity
of the number of comparisons your algorithm performs on this worst case data set? Support your answer.
You do not need to write the full pseudo-code, you may if you wish.
( 1 0 points ) Given a set of n numbers, we wish

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 Programming Questions!