#include
using namespace std;
void sway(int& a, int& b) {//在快排过程中,由于每一轮的high和loww会相遇,则引用的是同一块地址就会出现b=0的情况
a += b;
b = a - b;
a = a - b;
}
int partition(int a[], int low, int high) {
int flag = a[low];
int loww = low;
while (loww < high) {
while (loww<high && a[high]>flag)high–;
while (loww < high && a[loww] <= flag)loww++;
if(loww!=high)
sway(a[high], a[loww]);
}
if(loww!=low)
sway(a[loww], a[low]);
return loww;
}
void quick_sort(int a[],int low,int high) {
if (low < high) {
int temp=partition(a, low, high);
quick_sort(a, low, temp - 1);
quick_sort(a, temp+1, high);
}
}
int main()
{
int a[10];
for (int i = 0;i < 10;i++)cin >> a[i];
quick_sort(a,0,9);
for (int i = 0;i < 10;i++)cout << a[i] << " ";
}