#include #include #define MAX 50 // Sort the array int *sort(int *, int); // Return a pointer to an array populated void rnd(int* arr, int n); // QuickSort functions void swap(int* a, int* b); void quickSort(int arr[], int low, int high); int partition (int arr[], int low, int high); int main() { int* arr = new int[MAX]; rnd(arr, MAX); sort(arr,MAX); //output the sorted array for(auto i=0;i Array to be sorted, low --> Starting index, high --> Ending index */ void quickSort(int arr[], int low, int high) { if (low < high) { /* pi is partitioning index, arr[p] is now at right place */ int pi = partition(arr, low, high); // Separately sort elements before // partition and after partition quickSort(arr, low, pi - 1); quickSort(arr, pi + 1, high); } }