public interface DisjointSet
Modifier and Type | Method and Description |
---|---|
int |
distinct()
Returns the number of distinct sets.
|
int |
find(int i)
Returns a representative member of the set that i is part of.
|
int |
size()
Returns the number of elements.
|
void |
union(int i,
int j)
Unions the two sets specified by i and j.
|
int distinct()
int size()
int find(int i)
i
- specifies the set of which we want to find the representative membervoid union(int i, int j)
i
- member of the first setj
- member of the second set