doc: create Disjoin Set section

This commit is contained in:
Leon Xu committed 2022-04-04 15:27:02 -07:00
1 parent 4ecc66235b
commit 03531be231
1 file changed
+8 -1
+8 -1
View File
@@ -202,4 +202,11 @@ HashMap的key是独一的的
set.add(1);
set.add(2);
set.contains(1); //return true
set.contains(3); //return false
set.contains(3); //return false
## Disjoint Set(Union Find)
并查集 是一种树形的数据结构,用于处理不交集的合并(union)及查询(find)问题。找几个数字是否在同一个group里面
Find:确定元素属于哪一个子集。它可以被用来确定两个元素是否属于同一子集。
Union:将两个子集合并成同一个集合。
![union-find](/image/union-find.png)