[][src]Trait rust_black_trees::tree::BaseTree

pub trait BaseTree<T> {
    type MNode: Node<T>;
    fn get(&self, val: usize) -> &Self::MNode;
fn get_mut(&self, val: usize) -> &mut Self::MNode;
fn delete_node(&mut self, index: usize);
fn create_node(&mut self, val: T) -> usize;
fn rebalance_ins(&mut self, n: usize);
fn rebalance_del(&mut self, n: usize, child: usize);
fn delete_replace(&mut self, n: usize) -> usize;
fn replace_node(&mut self, to_delete: usize, to_attach: Option<usize>);
fn attach_child(&self, p: usize, c: usize, side: Side);
fn get_root(&self) -> Option<usize>;
fn set_root(&mut self, new_root: Option<usize>);
fn get_size(&self) -> usize;
fn crement_size(&mut self, val: isize); }

Associated Types

type MNode: Node<T>

Loading content...

Required methods

fn get(&self, val: usize) -> &Self::MNode

fn get_mut(&self, val: usize) -> &mut Self::MNode

fn delete_node(&mut self, index: usize)

fn create_node(&mut self, val: T) -> usize

fn rebalance_ins(&mut self, n: usize)

fn rebalance_del(&mut self, n: usize, child: usize)

fn delete_replace(&mut self, n: usize) -> usize

fn replace_node(&mut self, to_delete: usize, to_attach: Option<usize>)

fn attach_child(&self, p: usize, c: usize, side: Side)

fn get_root(&self) -> Option<usize>

fn set_root(&mut self, new_root: Option<usize>)

fn get_size(&self) -> usize

fn crement_size(&mut self, val: isize)

Loading content...

Implementors

impl<T> BaseTree<T> for AVLTree<T> where
    T: PartialOrd,
    T: PartialEq,
    T: Debug
[src]

type MNode = AVLNode<T>

fn get(&self, val: usize) -> &Self::MNode[src]

In order to return a reference to a value of a vector contained within a refcell, a raw pointer is used. The unsafe code could be avoided by replacing each call to self.get(n) with &self.data.borrow()[n] and each call to self.get_mut(n) with &mut self.data.borrow()[n]. This allows us to do the same thing with less keystrokes. It does make the program not thread-safe, but a this data structure is a pretty terrible choice for a multi-threaded data structure anyways, since re-balancing can require that most of the tree be locked to one thread during an insertion or deletion

impl<T> BaseTree<T> for RBTree<T> where
    T: PartialOrd,
    T: PartialEq,
    T: Debug
[src]

type MNode = ColorNode<T>

fn get(&self, val: usize) -> &Self::MNode[src]

In order to return a reference to a value of a vector contained within a refcell, a raw pointer is used. The unsafe code could be avoided by replacing each call to self.get(n) with &self.data.borrow()[n] and each call to self.get_mut(n) with &mut self.data.borrow()[n]. This allows us to do the same thing with less keystrokes. It does make the program not thread-safe, but a this data structure is a pretty terrible choice for a multi-threaded data structure anyways, since re-balancing can require that most of the tree be locked to one thread during an insertion or deletion

impl<T> BaseTree<T> for BSTree<T> where
    T: PartialOrd,
    T: PartialEq,
    T: Debug
[src]

type MNode = RegularNode<T>

fn get(&self, val: usize) -> &Self::MNode[src]

In order to return a reference to a value of a vector contained within a refcell, a raw pointer is used. The unsafe code could be avoided by replacing each call to self.get(n) with &self.data.borrow()[n] and each call to self.get_mut(n) with &mut self.data.borrow()[n]. This allows us to do the same thing with less keystrokes. It does make the program not thread-safe, but a this data structure is a pretty terrible choice for a multi-threaded data structure anyways, since re-balancing can require that most of the tree be locked to one thread during an insertion or deletion

Loading content...