i am trying to make the program to show me the New Order in the array.
thats why i typed cout<<"Array is: "<<swap(anArray[nStartIndex], anArray[nLargestIndex]); in stead of swap(anArray[nStartIndex], anArray[nLargestIndex]);
i just dont know how to make it show me the new order of numbers.
please help me ( is a homework. i need to solve it until tomorrow. )
void quickSort(int arr[], int left, int right) {
int i = left, j = right;
int tmp;
int pivot = arr[(left + right) / 2];
/* partition */
while (i <= j) {
while (arr[i] < pivot)
i++;
while (arr[j] > pivot)
j--;
if (i <= j) {
tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
i++;
j--;
}
};
/* recursion */
if (left < j)
quickSort(arr, left, j);
if (i < right)
quickSort(arr, i, right);
}