快排
来源:互联网 发布:python web 开发 编辑:程序博客网 时间:2024/04/30 10:02
class QuickSort {public: void quickSort_(int *A,int l,int r){ if(l<r){ int i=l; int j=r; int x=A[l]; while(i<j){ //cout<<i<<" "<<j<<endl; while(i<j && A[j]>x){ j--; } if(i<j){ A[i]=A[j]; } while(i<j && x>=A[i]){ i++; } if(i<j){ A[j]=A[i]; } } A[i]=x; quickSort_(A,l,i-1); quickSort_(A,i+1,r); } } int* quickSort(int* A, int n) { // write code here int l=0,r=n-1; quickSort_(A,l,r); return A; }};
0 0
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排
- 快排。
- 手机自适应设计代码以及案例
- 圆
- java实现二维码生成,使用Google zxing
- The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url
- ural 2065 - Different Sums
- 快排
- comparator接口与Comparable接口的区别
- 网格
- Java概述
- 凸包
- #155 Minimum Depth of Binary Tree
- 使用光线投射实现相机跟随
- web前端面试题
- jquery判断子元素是否存在