2020年2月9日
摘要: 并查集:一种维护集合的数据结构 一、合并onion 二、查找find 初始化、查找(路径压缩)、合并 堆:本质是二叉树 //并查集的复习 //堆的复习 #include<iostream> #include<cstring> #include<cmath> #include<algorithm> # 阅读全文
posted @ 2020-02-09 16:27 shirlybabyyy 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 树的存储(邻接表)和深度优先遍历 //数组的邻接表存储 vector<int> q[maxn]; //这个是一般的 int fi[maxn]; //存储节点的儿子个数 int to[maxn]; //存储节点的具体每个儿子 int ne[maxn]; //指向该节点的下一个儿子 void link( 阅读全文
posted @ 2020-02-09 01:35 shirlybabyyy 阅读(262) 评论(0) 推荐(0) 编辑