alexusli
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);
    //}
}

分类:

技术点:

相关文章:

  • 2021-12-19
  • 2022-03-04
  • 2021-09-19
  • 2022-02-19
  • 2022-02-03
  • 2021-12-29
  • 2021-12-19
  • 2021-12-19
猜你喜欢
  • 2021-12-29
  • 2021-12-29
  • 2021-11-17
  • 2021-10-26
  • 2022-01-24
  • 2021-07-14
相关资源
相似解决方案