doc: create Disjoin Set section
This commit is contained in:
1 parent
a98a125701
commit
957adf455a
1 file changed
+8
-1
@@ -202,4 +202,11 @@ HashMap的key是独一的的
|
|||||||
set.add(1);
|
set.add(1);
|
||||||
set.add(2);
|
set.add(2);
|
||||||
set.contains(1); //return true
|
set.contains(1); //return true
|
||||||
set.contains(3); //return false
|
set.contains(3); //return false
|
||||||
|
|
||||||
|
## Disjoint Set(Union Find)
|
||||||
|
并查集 是一种树形的数据结构,用于处理不交集的合并(union)及查询(find)问题。找几个数字是否在同一个group里面
|
||||||
|
Find:确定元素属于哪一个子集。它可以被用来确定两个元素是否属于同一子集。
|
||||||
|
Union:将两个子集合并成同一个集合。
|
||||||
|
|
||||||
|

|
||||||
Reference in new issue
Block a user