fn union(&mut self, p: usize, q: usize) {
        let id_p = self.find(p);
        let id_q = self.find(q);

        if id_p != id_q {
            self.parents[id_p] = self.find(id_q);
            self.count -= 1;
        }
    }
/// Connect two components. It is a linear time operation (O(N)) in the worst case because trees
/// can get tall.
///
/// # Arguments
///
/// * `p`: The index of the first component to connect
/// * `q`: The index of the second component to connect
Connect two components. It is a linear time operation (O(N)) in the worst case because trees
can get tall.
Connect two components . It is a linear time operation ( O ( N )) in the worst case because trees can get tall .
fn union(&mut self, p: usize, q: usize) {
        let id_p = self.find(p);
        let id_q = self.find(q);
        if id_p != id_q {
            self.parents[id_p] = self.find(id_q);
            self.count -= 1;
        }
    }
fn union ( & mut self , p : usize , q : usize ) { let id_p = self . find ( p ) ; let id_q = self . find ( q ) ; if id_p != id_q { self . parents [ id_p ] = self . find ( id_q ) ; self . count -= 1 ; } }
Connect two components.
Connect two components .
&mut self
p
usize
q
usize
&mut self
p
usize
q
usize