MCPcopy Create free account
hub / github.com/douchuan/algorithm / binary_search_tree_min_max

Function binary_search_tree_min_max

tests/test_bst_tree.rs:22–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21#[test]
22fn binary_search_tree_min_max() {
23 let mut tree = Tree::default();
24 let data = vec![4, 3, 8, 1, 7, 16, 2, 10, 9, 14];
25 for v in &data {
26 tree.insert(*v, *v);
27 }
28
29 //min
30 let v = tree.min();
31 assert_eq!(v, Some(&1));
32
33 //max
34 let v = tree.max();
35 assert_eq!(v, Some(&16));
36}
37
38#[test]
39fn binary_search_tree_succ_pred() {

Callers

nothing calls this directly

Calls 3

insertMethod · 0.45
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected