18 for (
int i = 0; i < n; i++ ) {
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
#define array_create_size(basic_type, capacity)
Creates a new dynamic array of ‘basic_type’ with an initial capacity.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_push_back(ptr_array, element)
Adds a new element at the end of the array.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
Disjoint set forest on {0, .., n-1}.
int * unionfind_findall(UnionFind *uf)
Returns a designated representative of each subset in an array (array.h).
int unionfind_find(UnionFind *uf, int x)
Finds the designated representative of the subset containing x.
void unionfind_init(UnionFind *uf, int n)
Creates a UnionFind structure on {0, ..., n}.
void unionfind_union(UnionFind *uf, int x, int y)
Declares x and y to be in the same subset.
void unionfind_free(UnionFind *uf)
Frees resources associated with uf.