Example #1
0
 static void union(Bubble a, Bubble b)
 {
     Bubble C = smaller(a, b);
     Bubble D = Greater(a, b);
     C.representative = D;
     C.changeRepresentative();
     D.children.Add(C);
     D.children.AddRange(C.children);
 }
Example #2
0
 static Bubble Greater(Bubble A, Bubble B)
 {
     return A.children.Count > B.children.Count ? A : B;
 }
Example #3
0
 static Bubble smaller(Bubble A, Bubble B)
 {
     return A.children.Count <= B.children.Count ? A : B;
 }
Example #4
0
 public Bubble(int me)
 {
     this.me = me;
     this.representative = this;
     this.children = new List<Bubble>();
 }