void swap(int *a,int*b)
{
int temp=*a;
*a=*b;
*b=temp;
}
int MYqsort (int *arr,int start,int end)
{
int low, higt;
int temp=arr[start];
if(start>=end)
return 0;
low=start+1;
higt=end;
while(low<higt)
{
if(arr[low]>temp)
{
swap(&arr[higt],&arr[low]);
higt--;
}
else {
low++;
}
}
if(arr[low]>=temp)
low--;
swap(&arr[start],&arr[low]);
MYqsort(arr,start,low);
MYqsort(arr,higt,end);
return 0;
}//快速排序
int main()
{
/* Write C code in this online editor and run it. */
int arr[10]={10,4,5,3,2,7,8,9,1,6};
MYqsort (arr,0,9);
int i=0;
for(i=0;i<10;i++)
{printf("%d ",arr[i]);
}
return 0;
}