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