Question: 1) Implement the median-of-three method for selecting a pivot value as a modification to Quick Sort. Run an experiment (at least 5 different inputs, including

1) Implement the median-of-three method for selecting a pivot value as a modification to Quick Sort. Run an experiment (at least 5 different inputs, including sorted and reverse sorted inputs) to compare two techniques, i.e. the Quick sort that selects the last element as the pivot, and the quick sort which uses median-of-three method to select the pivot. Do this in Java

2) There is a variation of the bubble sort algorithm called gap sort that, rather than comparing neighboring elements each time through the list, compares elements that are some number (i) positions apart, where i is an integer less than n. For example, the first element would be compared to the (i + 1) element, the second element would be compared to the (i + 2) element, the nth element would be compared to the (n - i) element, etc. A single iteration is completed when all of the elements that can be compared, have been compared. On the next iteration, i is reduced by some number greater than 1 and the process continues until i is less than 1. Implement a gap sort and create a driver program to exercise it. Do this in Java

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!