union find data structure with union by rank and path compression heuristics To use the library:
- include "DSU.h" in your source file.
- following functionalities are provided:
a. construct DSU with n groups.
b. add new group to the DSU.
c. merge two existing groups.
d. find the root of the group to which an element belongs.
e. find number of elements in the group to which an element belongs. - Example usage : DSU myDSU(n);