总结
来源:互联网 发布:东野圭吾小说推荐知乎 编辑:程序博客网 时间:2024/06/16 14:44
1.并查集
int find(int x)
{
int r=x;
while(pre[r]!=r)
r=pre[r];
int i,j;
while(pre[i]!=r)
j=pre[i];
pre[i]=r;
i=j;
}
2.运算符重载
friend bool operator < (struct a,struct y)
{
return a>b;//a的优先级高;
}//写在结构体内,有时候用在优先队列
3.优先队列
priority_queue <input> pg;
4.#include<algorithm>
sort<a,a+20>;
5.栈
#include<stack>
stack<int>st;
阅读全文
0 0