2. Modified Quicksort II
Choosing a pivot value can influence the efficiency of quicksorta lot. Ideally, the pivot should be the median value of the array,which results in equally sized left subarray and right subarray.However, finding median itself is non-trivial. We can approximatethe median by the median of three elements in the array: the first,the last, and the center. This is fast and it has a good chance ofgiving us something close to the real median.
#include <iostream>using namespace std;void quickSort(int a[], int low, int high);int partition(int a[], int low, int high);void swap(int &a, int &b);int main(){
PayPal Gateway not configured
PayPal Gateway not configured