
数据结构-并查集
LucienShui
因为孤独是人之常态,所以陪伴才显得格外可贵。
展开
-
POJ 2349 Arctic Network 最小生成树
POJ 2349 Arctic Network 最小生成树 Kruskal原创 2017-05-18 17:38:43 · 357 阅读 · 0 评论 -
Assign the task - HDU 3974 - 树 - 简单并查集
Assign the task - HDU 3974 - 树 - 简单并查集题目: There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If y原创 2017-06-01 17:45:29 · 378 阅读 · 0 评论 -
[模板] - 略优化的并查集
略优化的并查集模板 之前写过一个题,是并查集+搜索,思路很明确但是不论我用什么我目前已知的方法去写这个题都一直TLE,最后问了学长才知道在做并归操作的时候通过维护树高可以优化最后所得树的结构。 闲话不多,还是结合注释看代码吧。const int maxn = (int)1e5+7; int pre[maxn],height[maxn]; //pre就不解释了,height是当前树高int Fin原创 2017-05-15 14:28:56 · 292 阅读 · 0 评论