代码
 public void QuickSort(List<int> sqlist, int low, int hight)
        {
            
int i;
            
if (low > hight) return;
            i 
= Partition(sqlist, low, hight);
            QuickSort(sqlist, low, i 
- 1);
            QuickSort(sqlist, i 
+ 1, hight);
        }
private int Partition(List<int> sqllist, int p, int q)
        {
            
int i, j;
            i 
= p;
            j 
= q;
            
int temp = sqllist[i];
            
while (i < j)
            {
                
while (sqllist[j] > temp && i < j) j--;
                
if (i < j)
                { sqllist[i] 
= sqllist[j]; i++; }
                
while (sqllist[i] < temp && i < j) i++;
                
if (i < j)
                {
                    sqllist[j] 
= sqllist[i];
                    j
--;
                }
            }
            sqllist[i] 
= temp;
            
return i;
        }

 

posted on 2010-03-20 13:23  kuning的程序博客  阅读(200)  评论(0编辑  收藏  举报