主题:下面的快速排序代码有什么问题?
void quickSort(int a[],int left,int right)
{
int s=partition(a,left,right);
quickSort(a,left,s-1);
quickSort(a,s+1,right);
}
int partition(int a[],int left,int right)
{
int p=a[left];
int i=left;
int j=right+1;
do
{
do
{
i++;
}while(a[i]<=p);
do
{
j--;
}while(a[j]>=p);
a[i]=a[i]+a[j];
a[j]=a[i]-a[j];
a[i]=a[i]-a[j];
}while(i<=j);
a[i]=a[i]+a[j];
a[j]=a[i]-a[j];
a[i]=a[i]-a[j];
a[left]=a[left]+a[j];
a[j]=a[left]-a[j];
a[j]=a[left]-a[j];
return j;
}
{
int s=partition(a,left,right);
quickSort(a,left,s-1);
quickSort(a,s+1,right);
}
int partition(int a[],int left,int right)
{
int p=a[left];
int i=left;
int j=right+1;
do
{
do
{
i++;
}while(a[i]<=p);
do
{
j--;
}while(a[j]>=p);
a[i]=a[i]+a[j];
a[j]=a[i]-a[j];
a[i]=a[i]-a[j];
}while(i<=j);
a[i]=a[i]+a[j];
a[j]=a[i]-a[j];
a[i]=a[i]-a[j];
a[left]=a[left]+a[j];
a[j]=a[left]-a[j];
a[j]=a[left]-a[j];
return j;
}