MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / main

Function main

code/chapter07/bst.rs:196–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

194}
195
196fn main() {
197 let mut bst = BST::<i32,char>::new();
198 bst.insert(8, 'e'); bst.insert(6,'c');
199 bst.insert(7, 'd'); bst.insert(5,'b');
200 bst.insert(10,'g'); bst.insert(9,'f');
201 bst.insert(11,'h'); bst.insert(4,'a');
202
203 println!("empty: {:?}", bst.is_empty());
204 println!("len: {:?}", bst.len());
205 println!("min: {:?}", bst.min());
206 println!("max: {:?}", bst.max());
207 println!("key: 5, val: {:?}", bst.get(&5));
208 println!("5 in bst: {:?}", bst.search(&5));
209
210 println!("inorder: ");
211 bst.inorder();
212 println!("preorder: ");
213 bst.preorder();
214 println!("postorder: ");
215 bst.postorder();
216}

Callers

nothing calls this directly

Calls 4

insertMethod · 0.45
inorderMethod · 0.45
preorderMethod · 0.45
postorderMethod · 0.45

Tested by

no test coverage detected