quicksort(A,p,r)

{

if p < r;

   then q<- partition(A,p,r)

            quicksort(A,p,q-1)

            quicksort(A,p+1,r)

}

其中

partition(A,p,r)

{

x<-A[r]

i<-p-1

for j<-p to r-1

     do if A[j]<= x

              then i++;

                      exchange A[i]<->A[j]

exchange A[i+1]<->A[r]

return i+1

}

相关文章:

  • 2021-06-13
  • 2022-01-17
  • 2021-11-20
  • 2021-12-19
  • 2021-12-19
  • 2021-10-08
  • 2022-01-29
  • 2022-12-23
猜你喜欢
  • 2021-07-28
  • 2022-12-23
  • 2022-01-20
  • 2021-12-19
  • 2021-11-30
  • 2021-08-26
  • 2021-05-20
相关资源
相似解决方案