单调栈与单调队列 先直接上模版代码:单调栈#include <iostream>using namespace std;const int N = 100010;int stk[N],tt;int main(){//下面三行是加速的可以忽略 cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int n; cin >> n; for(int i = 0; i < n; ++i) {
快速排序算法的模版解释 快速排序算法的模版解释参考文章:快速排序算法的证明与边界分析(作者:醉生梦死) 快排属于分治算法,而分治算法一般都有三步1.分成子问题2.递归处理子问题3.子问题的合并而在快排中的体现就是:1.找到一个分界点 将排序区间分为两段(问题所在)3.递归处理两个子区间上模版:#include <iostream>const int N = 100010;int q[N],l,r;using namespace std;void quick_sort(int q[],i