fn insert(&mut self, value: T) {
        // Variables:
        // - `n` is the new node
        // - `p` will be it's parent
        // - `c` is the present child of `p`

        let n = self.arena.insert(Node::new(value));

        if self.root == NULL {
            self.root = n;
        } else {
            let mut p = self.root;
            loop {
                // Decide whether to go left or right.
                let dir = if self.arena[n].value < self.arena[p].value {
                    0
                } else {
                    1
                };
                let c = self.arena[p].children[dir];

                if c == NULL {
                    self.link(p, n, dir);
                    self.splay(n);
                    break;
                }
                p = c;
            }
        }
    }
/// Inserts a new node with specified `value`.
Inserts a new node with specified `value`.
Inserts a new node with specified ` value ` .
fn insert(&mut self, value: T) {
        // Variables:
        // - `n` is the new node
        // - `p` will be it's parent
        // - `c` is the present child of `p`
        let n = self.arena.insert(Node::new(value));
        if self.root == NULL {
            self.root = n;
        } else {
            let mut p = self.root;
            loop {
                // Decide whether to go left or right.
                let dir = if self.arena[n].value < self.arena[p].value {
                    0
                } else {
                    1
                };
                let c = self.arena[p].children[dir];
                if c == NULL {
                    self.link(p, n, dir);
                    self.splay(n);
                    break;
                }
                p = c;
            }
        }
    }
fn insert ( & mut self , value : T ) { // Variables: // - `n` is the new node // - `p` will be it's parent // - `c` is the present child of `p` let n = self . arena . insert ( Node :: new ( value ) ) ; if self . root == NULL { self . root = n ; } else { let mut p = self . root ; loop { // Decide whether to go left or right. let dir = if self . arena [ n ] . value < self . arena [ p ] . value { 0 } else { 1 } ; let c = self . arena [ p ] . children [ dir ] ; if c == NULL { self . link ( p , n , dir ) ; self . splay ( n ) ; break ; } p = c ; } } }
Inserts a new node with specified `value`.
Inserts a new node with specified ` value ` .
&mut self
value
T
&mut self
value
T