Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 5
0
def test_depth_all_left():
    bst = BST()
    for i in range(110,10,-10):
        bst.insert(i)
    assert bst.depth(bst.root) == 10
Esempio n. 6
0
def test_depth_all_left():
    bst = BST()
    for i in range(110, 10, -10):
        bst.insert(i)
    assert bst.depth(bst.root) == 10