pub struct BST<T>(/* private fields */);
Expand description
BinarySearchTree
This crate implements a Binary Search Tree data structure with insert, preorder traversal, search and validate algorithms.
Implementations§
Source§impl<T> BST<T>where
T: PartialOrd + Copy,
impl<T> BST<T>where
T: PartialOrd + Copy,
Sourcepub fn insert(&mut self, data: T) -> bool
pub fn insert(&mut self, data: T) -> bool
Insert into a new BinarySearchTree
§Example
use flex_algo::BST;
let mut bst = BST::new();
bst.insert(3);
bst.insert(2);
bst.insert(1);
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BST<T>
impl<T> RefUnwindSafe for BST<T>where
T: RefUnwindSafe,
impl<T> Send for BST<T>where
T: Send,
impl<T> Sync for BST<T>where
T: Sync,
impl<T> Unpin for BST<T>
impl<T> UnwindSafe for BST<T>where
T: UnwindSafe,
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