Go to the documentation of this file.
29 uf->
parent[root_q] = root_p;
34 uf->
parent[root_p] = root_q;
size_t count
The number of disconnected sets.
size_t * parent
An array with each element's parent.
Weighted quick-union by rank with path compression by halving.
void union_find_union(t_union_find *uf, size_t p, size_t q)
Merges the set containing element p with the set containing element q.
size_t union_find_find(const t_union_find *uf, size_t p)
Returns the canonical element of the set containing the specified element.
size_t * nchild
An array with the number of each element's children.
void ds_exit_set(int err)
Set errno to the specified value, print the error message, and exit the process.
size_t size
The number of elements.