Class RemUnionFind
Defined in File RemUnionFind.h
Class Documentation
-
class RemUnionFind
the union of disjoint sets of the elements 0 , … , n - 1
Public Functions
-
explicit RemUnionFind(std::size_t n = 0)
the n sets {0} , … , {n - 1}
- Pre:
0 <= n < 2^32
-
std::size_t n(void) const
the number of the elements
-
std::size_t count(void) const
the number of the sets
-
std::uint32_t find(std::uint32_t x)
the representative of the set of x, the root of its tree
- Pre:
x < n()
-
bool merge(std::uint32_t x, std::uint32_t y)
joins the sets of x and y; true if they were distinct
-
bool same(std::uint32_t x, std::uint32_t y)
whether x and y are in the same set
-
std::uint32_t parent(std::uint32_t x) const
the parent of x, x itself if a root
-
explicit RemUnionFind(std::size_t n = 0)