hi all,
when i run this code (quick sort), i ll get ascending order as output... now i want descending order instead... anybody know how to altert this code..uhuhuh
void QuickSorting::sort(int a[], int lo, int up)
{
{
int i, j, pivot;
while ( up>lo )
{
i = lo;
j = up;
pivot = a[lo];
while ( i<j )
{
for ( ; a[j] > pivot; j-- );
for ( a[i]=a[j]; i<j && a[i]<=pivot; i++ );
a[j] = a[i];
}
a[i] = pivot;
if ( i-lo < up-i )
{ sort(a,lo,i-1); lo = i+1; }
else
{ sort(a,i+1,up); up = i-1; }
}
}
}
output: 12345 -- would like to change to : 54321