Ejemplo n.º 1
0
def test_add3():
    lista = [18, 73, 98, 9]
    avl_tree = AvlTree(lista)
    avl_tree.add_node(AvlNode(33))
    avl_tree.add_node(AvlNode(16))
    avl_tree.add_node(AvlNode(64))
    avl_tree.add_node(AvlNode(58))
    avl_tree.print()
Ejemplo n.º 2
0
def test_trunk_value():
    test_tree = AvlTree([1, 2, 3, 4])
    test_tree.print()
    assert test_tree.trunk.value == 2
    # test_tree.add_node(AvlNode(5))
    test_tree = AvlTree([1, 2, 3, 4, 5])
    test_tree.print()
    assert test_tree.trunk.value == 2
    test_tree = AvlTree([1, 2, 3, 4, 5, 6])
    test_tree.print()
    assert test_tree.trunk.value == 4
Ejemplo n.º 3
0
def print_example_tree():
    lista = [16, 8, 3, 5, 9, 10, 18, 4, 6, 1]
    avl_tree = AvlTree(lista)
    print("Input do drzewa: "+str(lista))
    avl_tree.print()
Ejemplo n.º 4
0
def test_add2():
    lista = [1, 7, 6, 5, 4, 2]
    avl_tree = AvlTree(lista)
    avl_tree.print()
Ejemplo n.º 5
0
def test_add():
    lista = [1, 2, 3, 4, 5, 6]
    avl_tree = AvlTree(lista)
    avl_tree.print()