| 194 | } |
| 195 | |
| 196 | fn 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 | } |