快排算法C语言实现

    • void quickSort(int a[],int begin,int end)
      {
      if(begin >= end)
      {
      return;
      }//递归结束条件
      int i = begin;
      int j = end;
      int tempValue = a[i];
      while( i != j)
      {
      while(i < j && a[j] >= tempValue)
      --j;
      if(i < j)
      {
      a[i] = a[j];
      i++;
      }

      while( i < j && a[i] <= tempValue)
      ++i;
      if(i < j)
      {
      a[j] = a[i];
      j--;
      }
      }
      a[i] = tempValue;
      quickSort(a,begin,i-1);
      quickSort(a,i+ 1,end);
      }

posted @ 2021-04-19 16:33  beautifulday  阅读(311)  评论(0编辑  收藏  举报