pub struct AVLTree<T> { /* private fields */ }
Expand description
Arena based memory tree structure
Trait Implementations§
Source§impl<T> BaseTree<T> for AVLTree<T>
impl<T> BaseTree<T> for AVLTree<T>
Source§fn get(&self, val: usize) -> &Self::MNode
fn get(&self, val: usize) -> &Self::MNode
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
type MNode = AVLNode<T>
fn get_mut(&self, val: usize) -> &mut Self::MNode
fn get_root(&self) -> Option<usize>
fn set_root(&mut self, new_root: Option<usize>)
fn crement_size(&mut self, amount: isize)
fn attach_child(&self, p: usize, c: usize, side: Side)
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 get_size(&self) -> usize
fn create_node(&mut self, val: T) -> usize
fn delete_node(&mut self, index: usize)
Source§impl<T> Tree<T> for AVLTree<T>
impl<T> Tree<T> for AVLTree<T>
fn new() -> Self
fn is_empty(&self) -> bool
fn contains(&self, val: &T) -> bool
fn insert(&mut self, val: T)
fn delete(&mut self, val: T) -> bool
fn rotate(&mut self, side: Side, n: usize)
fn find(&self, val: &T) -> usize
fn get_height(&self) -> usize
fn get_leaf_count(&self) -> usize
fn to_string(&self) -> String
fn to_pretty_string(&self) -> String
Auto Trait Implementations§
impl<T> Freeze for AVLTree<T>
impl<T> !RefUnwindSafe for AVLTree<T>
impl<T> !Send for AVLTree<T>
impl<T> !Sync for AVLTree<T>
impl<T> Unpin for AVLTree<T>
impl<T> !UnwindSafe for AVLTree<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more