diff --git a/source/_posts/数据结构.md b/source/_posts/数据结构.md index abc1c61..f55824b 100644 --- a/source/_posts/数据结构.md +++ b/source/_posts/数据结构.md @@ -202,4 +202,11 @@ HashMap的key是独一的的 set.add(1); set.add(2); set.contains(1); //return true -set.contains(3); //return false \ No newline at end of file +set.contains(3); //return false + +## Disjoint Set(Union Find) +并查集 是一种树形的数据结构,用于处理不交集的合并(union)及查询(find)问题。找几个数字是否在同一个group里面 +Find:确定元素属于哪一个子集。它可以被用来确定两个元素是否属于同一子集。 +Union:将两个子集合并成同一个集合。 + +![union-find](/image/union-find.png)