pub struct TreeNode<T: Ord + Copy + Debug + Display> {
pub value: T,
/* private fields */
}Expand description
Node struct for AVLTree
Fields§
§value: TTrait Implementations§
Source§impl<T: Ord + Copy + Debug + Display> CommonTreeNodeTrait<T> for TreeNode<T>
impl<T: Ord + Copy + Debug + Display> CommonTreeNodeTrait<T> for TreeNode<T>
Source§fn get_value_to_print(&self) -> String
fn get_value_to_print(&self) -> String
Get value string from current node
Source§fn count_leaves(&self) -> u32
fn count_leaves(&self) -> u32
Return the leaves number of current node, which will be called by
CommonTreeTrait.count_leaves
Source§fn get_height(&self) -> u32
fn get_height(&self) -> u32
Return the height of current node, which will be called by
CommonTreeTrait.height
Source§fn in_order_traversal(&self)
fn in_order_traversal(&self)
Print nodes inorder, which will be called by
CommonTreeTrait.in_order_traversal
fn in_order_traversal_for_test(&self, container: &mut Vec<T>)
Source§fn pre_order_traversal(&self)
fn pre_order_traversal(&self)
Print nodes preorder, which will be called by
CommonTreeTrait.pre_order_traversal
fn pre_order_traversal_for_test(&self, container: &mut Vec<T>)
Source§fn contains(&self, value: T) -> bool
fn contains(&self, value: T) -> bool
Determine whether the node and its successors contains given value,
which will be called by
CommonTreeTrait.contains
fn get_min_value_in_children(&self) -> T
fn get_max_value_in_children(&self) -> T
fn print(&self)
fn print_helper( &self, row_index: usize, column_index: usize, container: &mut [&mut [String]], height: usize, )
Source§impl<T: Ord + Copy + Debug + Display> CommonTreeTrait<T, TreeNode<T>> for AVLTree<T>
impl<T: Ord + Copy + Debug + Display> CommonTreeTrait<T, TreeNode<T>> for AVLTree<T>
fn get_root(&self) -> Option<Rc<RefCell<TreeNode<T>>>>
Source§fn count_leaves(&self) -> u32
fn count_leaves(&self) -> u32
Counts leaves(None nodes) of the Tree Read more
Source§fn in_order_traversal(&self)
fn in_order_traversal(&self)
Prints Tree inorder Read more
fn in_order_traversal_for_test(&self, container: &mut Vec<T>)
Source§fn pre_order_traversal(&self)
fn pre_order_traversal(&self)
Prints red-black tree preorder Read more
fn pre_order_traversal_for_test(&self, container: &mut Vec<T>)
Source§fn contains(&self, value: T) -> bool
fn contains(&self, value: T) -> bool
Determine whether the tree contains given value Read more
fn is_tree_empty(&self) -> bool
fn min(&self) -> Option<T>
fn max(&self) -> Option<T>
fn print(&self)
Source§impl<T: PartialEq + Ord + Copy + Debug + Display> PartialEq for TreeNode<T>
impl<T: PartialEq + Ord + Copy + Debug + Display> PartialEq for TreeNode<T>
impl<T: Ord + Copy + Debug + Display> StructuralPartialEq for TreeNode<T>
Auto Trait Implementations§
impl<T> Freeze for TreeNode<T>where
T: Freeze,
impl<T> !RefUnwindSafe for TreeNode<T>
impl<T> !Send for TreeNode<T>
impl<T> !Sync for TreeNode<T>
impl<T> Unpin for TreeNode<T>where
T: Unpin,
impl<T> UnsafeUnpin for TreeNode<T>where
T: UnsafeUnpin,
impl<T> !UnwindSafe for TreeNode<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