@@ -0,0 +1,514 @@
+public class QuickFindUF%0A%7B%0A  private int%5B%5D id;%0A  %0A  //Default constructor%0A  public QuickFindUF(int N)%0A  %7B%0A    id = new int%5BN%5D; //init the array of N size%0A    for (int i = 0; i %3C N; i++) %7B%0A      id%5Bi%5D = i; //set id of each object to itself%0A    %7D%0A  %7D%0A  %0A  public boolean connected(int p, int q) %0A  %7B%0A    return id%5Bp%5D == id%5Bq%5D;%0A  %7D%0A  %0A  public void union(int p, int q)%0A  %7B%0A    int pid = id%5Bp%5D;%0A    int qid = id%5Bq%5D;%0A    %0A    for (int i = 0; i %3C id.length(); i++)%0A    %7B%0A      if (id%5Bi%5D == pid) id%5Bi%5D = qid;%0A    %7D%0A  %7D%0A%7D%0A

Create QuickFindUF.java