| Constructor and Description |
|---|
UnionFind(int n)
Initializes the disjoint-set data structure.
|
public UnionFind(int n)
n - the overall size of the domainpublic int union(int p, int q)
p - the first elementq - the second elementpublic int link(int x, int y)
x - the first sety - the second setpublic int find(int x)
x - the elementCopyright © 2013. All Rights Reserved.