快速排序算法源码

//从小到大的顺序
void quicksort(int a[], int left,int right) 
{ 
    int i,j,t,temp; 
    if(left>right) 
       return; 
                                
    temp=a[left]; //temp中存的就是基准数 
    i=left; 
    j=right; 
    while(i!=j) 
    { 
                   //顺序很重要,要先从右边开始找 
                   while(a[j]>=temp && iright) 
       return; 
                                
    temp=a[left]; //temp中存的就是基准数 
    i=left; 
    j=right; 
    while(i!=j) 
    { 
                   //顺序很重要,要先从右边开始找 
                   while(a[j]<=temp && i=temp && i

你可能感兴趣的:(基础算法)