1 void my_sort(int l,int r)
 2 {
 3     int i=l,j=r,mid=a[(l+r)>>1];
 4     while (i<=j)
 5     {
 6         while (a[i]<mid)
 7             i++;
 8         while (a[j]>mid)
 9             j--;
10         if (i<=j)
11         {
12             swap(a[i],a[j]);
13             i++;
14             j--;
15         }
16     }
17     if (j>l)
18         my_sort(l,j);
19     if (i<r)
20         my_sort(i,r);
21 }

 

相关文章:

  • 2022-01-12
  • 2021-09-03
  • 2021-11-17
  • 2019-08-19
  • 2021-07-15
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2021-07-03
  • 2021-10-15
相关资源
相似解决方案