In quicksort instead of selecting three elements as is done


Question: In quicksort, instead of selecting three elements, as is done for median-of-three partitioning, suppose we are willing to select nine elements, including the first and last, with the other seven equally spaced in the array.

a. Write code to implement median-of-nine partitioning.

b. Consider the following alternate to median-of-nine: group the items into three groups of three. Find the medians of the three groups. Then use the median of those medians. Write code to implement this alternative, and compare its performance to median-of-nine partitioning.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: In quicksort instead of selecting three elements as is done
Reference No:- TGS02457802

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)