public class UnionFindWithSize extends UnionFind
array, size| Constructor and Description |
|---|
UnionFindWithSize() |
| Modifier and Type | Method and Description |
|---|---|
int |
addElement()
Adds a new element to this union find structure and returns its index.
|
protected void |
connectToRepresentative(int element,
int representative)
Connects the given element (must also be representative) to the given
representative.
|
int |
getClusterSize(int element)
Returns the size of the union cluster containing the given element.
|
addArrayElement, addArrayElementspublic UnionFindWithSize()
public int addElement()
addElement in class UnionFindprotected void connectToRepresentative(int element, int representative)
connectToRepresentative in class UnionFindpublic int getClusterSize(int element)