include[HTML_REMOVED]
include[HTML_REMOVED]
void swap(int a, int b)
{
int tmp = a;
a = b;
b = tmp;
}
void quick_p(int* a, int i, int j)
{
if (i >= j)
return;
int d = i + (j - i) / 2;
int x = i;
int y = j;
while (x <= y)
{
while (a[x] > a[d])
{
x++;
}
while (a[y] < a[d])
{
y--;
}
if (x <= y)
{
swap(&a[x], &a[y]);
x++;
y--;
}
}
quick_p(a, i, y);
quick_p(a, x, j);
}
int main()
{
int n = 0;
scanf_s(“%d”, &n);
int a = (int)malloc(n * sizeof(int));
for (int i = 0; i < n; i)
{
scanf_s(“%d”,&a[i]);
}
quick_p(a, 0, n-1);
for (int i = 0; i < n; i)
{
printf(” %d “, a[i]);
}
return 0;
}