Class UF

java.lang.Object
  |
  +--UF

public class UF
extends Object

Union-Find


Constructor Summary
UF(int N)
          Constructs a new UF with at most N
 
Method Summary
 boolean UFfind(int p, int q)
          Finds out whether the two integers are in union/coneected.
 void UFunion(int p, int q)
          Put's in union the two integers (connects them).
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UF

public UF(int N)
Constructs a new UF with at most N
Parameters:
N - the maximum number of integers for this UF
Method Detail

UFfind

public boolean UFfind(int p,
                      int q)
Finds out whether the two integers are in union/coneected.
Parameters:
p - first integer
q - second integer
Returns:
true if the integers are in union/connected
See Also:
UFunion(int, int)

UFunion

public void UFunion(int p,
                    int q)
Put's in union the two integers (connects them).
Parameters:
p - first integer
q - second integer
See Also:
UFfind(int, int)


Visualization of Graph Algorithms

Author: Paul Simbi
Started by: Kevin Wayne
2002