摘要: #include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace std; const int N=1e5+10; int q[N],n,tmp[N]; void mergeSort(int q[],in 阅读全文
posted @ 2021-07-12 21:45 infocodez 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 785. 快速排序 - AcWing题库 l + r >> 1的值一定是小于r的,不会取到r。l<r, l+r<2r, (l+r>>1)<(2r>>1), (l+r>>1)<r 而l + r + 1 >> 1的值一定是大于l的,不会取到l。证明类比于上面 >>右移1位,等同于/2 主要注意越界问题 阅读全文
posted @ 2021-07-12 19:10 infocodez 阅读(130) 评论(0) 推荐(0) 编辑