/// Unions the sets containing x and y
Unions the sets containing x and y
Unions the sets containing x and y
pub fn union(&mut self, x: usize, y: usize) -> bool {
        let x = self.find(x);
        let y = self.find(y);
        if x == y {
            return false;
        }
        if self.size[x] < self.size[y] {
            self.id[x] = y;
            self.size[y] += self.size[x];
        } else {
            self.id[y] = x;
            self.size[x] += self.size[y];
        }
        self.count -= 1;
        true
    }
pub fn union ( & mut self , x : usize , y : usize ) -> bool { let x = self . find ( x ) ; let y = self . find ( y ) ; if x == y { return false ; } if self . size [ x ] < self . size [ y ] { self . id [ x ] = y ; self . size [ y ] += self . size [ x ] ; } else { self . id [ y ] = x ; self . size [ x ] += self . size [ y ] ; } self . count -= 1 ; true }
Unions the sets containing x and y
Unions the sets containing x and y
&mut self
x
usize
y
usize