排序之快排_C/C++

  int Partition(int a[],int nLow,int nHigh)                 
{                                                  
  int nTemp=a[nHigh];    
   int i = nLow, j=nLow-1;   
	  for(; i<nHigh; i++)
       {
            if( a[i]<=nTemp )
                { j++;
                  if(i !=j ) swap(a[i], a[j]);
                 } 
       }
    swap(a[j+1],a[nHigh]);
   return (j+1); 

}
void Qsort(int a[],int nLow,int nHigh)             
{                                                                                                        
 if(nLow < nHigh)                                         
    {  int nIndex=Partition(a , nLow, nHigh); 
        Qsort(a, nLow, nIndex-1);                            
        Qsort(a , nIndex+1, nHigh);                            
    }                                                 
} 	
/****
135246
6
135246
5
132546
3
132456
1
123456
*******/

link

http://blog.csdn.net/left_la/article/details/8206405