Skip to content

并查集 | LearningGp #25

Description

@LearningGp

https://arvinhe.club/2021/01/13/%E5%B9%B6%E6%9F%A5%E9%9B%86/#more

概念
并查集是一种树形的数据结构,顾名思义,它用于处理一些不交集的 合并 及 查询 问题。 它支持两种操作:

查找(Find):确定某个元素处于哪个子集;
合并(Union):将两个子集合并成一个集合。

结构
在理解上并查集是一个森林,但是在实际实现上位了方便将其简化成数组。
理解上的结构
结构
每棵树代表一个子集,根节点用来标记这个子集
操作

find:递归查找父

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions