Hey, I'd appreciate if someone would help me modify this code so the descending order can be displayed on the screen , here it is....
#include <iostream> // ostream
#include <vector>
#define SIZE 10
using namespace std;
int partition(vector<long unsigned int> & a, int start, int end) {
unsigned int pivot = a[start];
unsigned int from_left = start+1;
unsigned int from_right = end;
unsigned int tmp;
while (from_left != from_right) {
if (a[from_left] <= pivot) from_left++;
else {
while (( from_left != from_right) && (pivot < a[from_right])) from_right--;
tmp = a[from_right];
a[from_right] = a[from_left];
a[from_left] = tmp;
}
}
if (a[from_left]>pivot) from_left--;
a[start] = a[from_left];
a[from_left] = pivot;
return (from_left);
}
void quickSort(vector <long unsigned int> & a, int p, int r) {
if (p < r) {
int q = partition(a, p, r);
quickSort(a, p, q - 1);
quickSort(a, q + 1, r);
}
}
int main() {
int a[SIZE] = {23,43,54,56,77,43,24,97,34,10};
vector <long unsigned int> V (a,a+SIZE);
quickSort(V, 0, SIZE-1);
for( long unsigned int i = 0; i < SIZE; i++){
cout<<V[i]<<endl;
}
return 0;
}