public class UnionFind extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
UnionFind.Element |
| Constructor and Description |
|---|
UnionFind() |
| Modifier and Type | Method and Description |
|---|---|
void |
allocate(int N) |
int |
find(int x) |
int |
find(int p,
int q) |
void |
free() |
UnionFind.Element |
getElement(int index) |
int |
getNumElements() |
boolean |
isRoot(int x) |
void |
reset(int N) |
void |
sortIslands()
This is a special operation, destroying the content of UnionFind.
|
void |
unite(int p,
int q) |
public void sortIslands()
public void reset(int N)
public int getNumElements()
public boolean isRoot(int x)
public UnionFind.Element getElement(int index)
public void allocate(int N)
public void free()
public int find(int p,
int q)
public void unite(int p,
int q)
public int find(int x)