예제 #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);
 }
예제 #2
0
 static Bubble Greater(Bubble A, Bubble B)
 {
     return A.children.Count > B.children.Count ? A : B;
 }
예제 #3
0
 static Bubble smaller(Bubble A, Bubble B)
 {
     return A.children.Count <= B.children.Count ? A : B;
 }
예제 #4
0
 public Bubble(int me)
 {
     this.me = me;
     this.representative = this;
     this.children = new List<Bubble>();
 }