标签:io ar on art amp c ui return 递归
//快速排序
void Quick_Sort(int *a,int low,int high)
{
int Partition(int *a,int low,int high);
int mid;
if(low<high)
{
mid=Partition(a,low,high);
Quick_Sort(a,low,mid-1);/*递归调用*/
Quick_Sort(a,mid+1,high);
}
}
int Partition(int *a,int low,int high)
{
int mid,temp;
int i=low,j=high+1;
mid=a[low];
while(i < j)
{
while((a[++i] < mid)&&i<high);
while(a[--j]>mid);
if(i>=j)break;
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
a[low]=a[j];
return j;
}
标签:io ar on art amp c ui return 递归
原文地址:http://www.cnblogs.com/jamsbwo/p/4100267.html