Disjoint Set Union (Union Find)
DSU
The Disjoint Set Union (DSU) data structure, which allows you to add edges to a graph and test whether two vertices of the graph are connected.
Here is a great source of explaining the logics behind DSU data structure (including template code).
Last updated