快速排序算法

快排,从小到大排序

 1 void quicksort(int a[],int low,int high)
 2 {
 3     int i=low;
 4     int j=high;
 5     int temp=a[i];
 6     if(i<j)
 7     {
 8         while(i<j)
 9         {
10             while(a[j]>=temp&&i<j) j--;                             
11             a[i]=a[j];
12             while(a[i]<=temp&&i<j) i++;
13             a[j]=a[i];
14         } 
15         a[i]=temp;
16         quicksort(a,low,i-1);
17         quicksort(a,j+1,high);
18     }
19     else return;   
20 }
原文地址:https://www.cnblogs.com/lqquan/p/3756877.html