| TCH (statz) | ![]() #1, Főfasz (10579) |
430 | #3830 | ^ | Idézet | Fri, 20 Nov 2015 13:12:25 +01 |
| 188.36.*.* |
|
*.catv.pool.telekom.hu |
#ifndef _QUICKSORT_C
#define _QUICKSORT_C 1
void quicksort(int a[], int lo, int hi)
{
int i, j, pivot, t;
if (lo < hi)
{
pivot = a[lo];
i = lo - 1;
j = hi + 1;
while (1)
{
while (a[--j] > pivot);
while (a[++i] < pivot);
if (i < j)
{
t = a[i];
a[i] = a[j];
a[j] = t;
}
else
{
break;
}
}
quicksort(a, lo, j);
quicksort(a, j + 1, hi);
}
}
#endif |