int Partition(int a[],int l,int r)
{
int p = a[l];//取首元素作为划分点
while(l<r)
{
while(l<r&& a[r]>=p)
--r;
a[l] = a[r];
while(l<r&& a[l]<=p)
++l;
a[r] = a[l];
}
a[l] = p;
return l;
}
void QSort(int a[],int l,int r)
{
int p;
if(l<r)
{
p = Partition(a,l,r);
for(int i = l; i< r;++i)
{
cout<<a[i]<<" ";
}
cout<<endl;
QSort(a,l,p-1);
QSort(a,p+1,r);
}
}