def test_depth(): bst = BST() bst.insert(5) assert bst.depth(node=bst.root) == 1 bst.insert(3) bst.insert(4) bst.insert(6) assert bst.depth(node=bst.root) == 3
def test_depth_collatz(): bst = BST() for i in range(1, 11): if not i % 2: i /= 2 else: i = i * 3 + 1 bst.insert(i) assert bst.depth(bst.root) == 5
def test_depth_all_left(): bst = BST() for i in range(110,10,-10): bst.insert(i) assert bst.depth(bst.root) == 10
def test_depth_all_left(): bst = BST() for i in range(110, 10, -10): bst.insert(i) assert bst.depth(bst.root) == 10