void QuickSort::QuickSort_Sort(int low,int high)
{
    int Pivot_Key=Int_Vector[low],i=low,j=high;
    while(i<j)
    {
        while(i<j&&Int_Vector[j]>=Pivot_Key)
        {
            j--;
        }
        if(i<j)
        {
            Swap_Value(Int_Vector[i],Int_Vector[j]);
        }
        while(i<j&&Int_Vector[i]<=Pivot_Key)
        {
            i++;
        }
        if(i<j)
        {
            Swap_Value(Int_Vector[i],Int_Vector[j]);
        }
    }
    if(i!=low) QuickSort_Sort(low,i-1);
    if(j!=high) QuickSort_Sort(j+1,high);
    /*int  Pivot_Key_Pos;*/
    //while(low<high)
    //{
    //    Pivot_Key_Pos=GetPartion(low,high);
    //    QuickSort_Sort(low,Pivot_Key_Pos-1);
    //    QuickSort_Sort(Pivot_Key_Pos+1,high);
    //}
}
posted on 2009-09-19 05:39  AlexusLi  阅读(957)  评论(0编辑  收藏  举报