fn find(&mut self, p: usize) -> usize {
        if p >= self.parents.len() {
            panic!("Index {} is out of bounds", p)
        }
        let mut id_root = p;
        while id_root != self.parents[id_root] {
            id_root = self.parents[id_root]
        }
        // Set the id of every node in the path to point to the root
        let mut id_p = p;
        while id_p != id_root {
            let new_p = self.parents[id_p];
            self.parents[id_p] = id_root;
            id_p = new_p;
        }

        id_root
    }
/// Return the identifier of a component. It is a linear time operation (O(n)) in the worst case
/// because trees can get tall
///
/// * `p`: The index of the component
Return the identifier of a component. It is a linear time operation (O(n)) in the worst case
because trees can get tall

`p`: The index of the component
Return the identifier of a component . It is a linear time operation ( O ( n )) in the worst case because trees can get tall ` p ` : The index of the component
fn find(&mut self, p: usize) -> usize {
        if p >= self.parents.len() {
            panic!("Index {} is out of bounds", p)
        }
        let mut id_root = p;
        while id_root != self.parents[id_root] {
            id_root = self.parents[id_root]
        }
        // Set the id of every node in the path to point to the root
        let mut id_p = p;
        while id_p != id_root {
            let new_p = self.parents[id_p];
            self.parents[id_p] = id_root;
            id_p = new_p;
        }
        id_root
    }
fn find ( & mut self , p : usize ) -> usize { if p >= self . parents . len ( ) { panic ! ( " " p ) } let mut id_root = p ; while id_root != self . parents [ id_root ] { id_root = self . parents [ id_root ] } // Set the id of every node in the path to point to the root let mut id_p = p ; while id_p != id_root { let new_p = self . parents [ id_p ] ; self . parents [ id_p ] = id_root ; id_p = new_p ; } id_root }
Return the identifier of a component.
Return the identifier of a component .
&mut self
p
usize
&mut self
p
usize