![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并查集
文章平均质量分 80
dama677409
这个作者很懒,什么都没留下…
展开
-
九度OJ题目 1526 朋友圈 并查集
题目描述:假如已知有n个人和m对好友关系(存于数字r)。如果两个人是直接或间接的好友(好友的好友的好友...),则认为他们属于同一个朋友圈,请写程序求出这n个人里一共有多少个朋友圈。假如:n = 5 , m = 3 , r = {{1 , 2} , {2 , 3} , {4 , 5}},表示有5个人,1和2是好友,2和3是好友,4和5是好友,则1、2、3属于一个朋友圈,4、5属于另一个朋友原创 2013-09-19 14:49:36 · 1390 阅读 · 0 评论 -
Is It A Tree?,判断是否是一棵树。(题目来源:九度OJ 1481,2012年北京大学计算机研究生机试真题)
题目描述:A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties原创 2013-11-13 17:27:22 · 841 阅读 · 0 评论