public final class UnionFindSimple
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) int[] |
data |
(package private) static int |
SZ |
Constructor and Description |
---|
UnionFindSimple(int maxid) |
Modifier and Type | Method and Description |
---|---|
int |
connectNodes(int aid,
int bid)
returns the id of the merged node.
|
int |
getRepresentative(int id) |
int |
getSetSize(int id) |
static void |
main(java.lang.String[] args) |
void |
reset() |
int |
size() |
int[] data
static final int SZ
public UnionFindSimple(int maxid)
maxid
- The maximum node id that will be referenced.public void reset()
public int size()
public int getSetSize(int id)
public int getRepresentative(int id)
public int connectNodes(int aid, int bid)
public static void main(java.lang.String[] args)