Ai
1 Star 0 Fork 127

夜景/数据结构(C++模板实现)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
disjoint_set.h 976 Bytes
一键复制 编辑 原始数据 按行查看 历史
Y_Dash 提交于 2023-06-16 11:21 +08:00 . 线索树完善doxygen
/*!
* @file disjoint_set.h
* @author CyberDash计算机考研, cyberdash@163.com(抖音id:cyberdash_yuan)
* @brief 并查集.h文件
* @version 0.2.1
* @date 2021-02-21
*/
#ifndef CYBER_DASH_DISJOINT_SET_H
#define CYBER_DASH_DISJOINT_SET_H
/*!
* @brief **并查集类**
*/
class DisjointSet {
public:
// 构造函数
explicit DisjointSet(int size);
/*!
* @brief **析构函数**
* @note
* 析构函数
* -------
* -------
*
* -------
* 释放parents_
*
*
* -------
*/
~DisjointSet() { delete[] parents_; }
// 合并
void Union(int node1, int node2);
// 查找(递归)
int FindRecursive(int index);
// 合并集合(Weighted)
void WeightedUnion(int node1, int node2);
// 查找
int Find(int index);
private:
int size_; //!< **大小**
int* parents_; //!< **父节点数组**
};
#endif //CYBER_DASH_DISJOINT_SET_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yuanermm/data-structures-cpp.git
git@gitee.com:yuanermm/data-structures-cpp.git
yuanermm
data-structures-cpp
数据结构(C++模板实现)
master

搜索帮助