disjoint_set.h

来自「最小生成树 MST的四种算法实现。 包括普通的Kruskal算法和Prim算法」· C头文件 代码 · 共 25 行

H
25
字号
#ifndef DISJOINT_SET_H
#define DISJOINT_SET_H

/*
	a little more complex implement, but save lots of stack memory
	@param father	The array to record every node's father node
	@param k		The node which you want to find the root of it
*/
int		root(int *father, int k);

/*
	merge two node a and b, and the trees represented by them 
	@param a		The first node 
	@param b		The second node
*/
void	merge(int a, int b);

/*
	create a array with size of "size" to record the father node of every node
	returned an int array
	@param size		The size of the node set
*/
int	*	create_father(int size);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?