快速排序

妹的,写了那么多的东西,网页卡死了,编辑不了了。快排的描述就不写了,直接上代码

QuickSort(DataType Arry[],int low,int hight)

{

int i= low;

int j=hight;

int temp = Arry[i];

while(i<j)

{

  while(i<j && temp > Arry[j])i++;

  if(i<j)

  {

  Arry[j] = Arry[i];

  j--;

  }

  while(i<j &&temp < Arry[i])j--;

  if(i<j)

  {

    Arry[i] = Arry[j];

    i++;

  }

  Arry[i] = temp;

  if(low < i) QuickSort(Arry,low,i-1);

  if(i<hight)QuickSort(Arry,j+1,hight);

}

}

posted @ 2016-07-05 22:30  first_semon  阅读(133)  评论(0编辑  收藏  举报