Ejemplo n.º 1
0
def test_pop_max_reverse_ordered():
    bst = BinarySearchTree()

    item_list = list(range(10))[::-1]

    for item in item_list:
        bst.add_value(item)

    assert bst.pop_max() == 9
Ejemplo n.º 2
0
def test_pop_max_random():
    bst = BinarySearchTree()

    item_list = list(range(10))

    shuffled_item_list = item_list[:]
    random.shuffle(shuffled_item_list)

    for item in shuffled_item_list:
        bst.add_value(item)

    assert bst.pop_max() == 9
Ejemplo n.º 3
0
def test_pop_max_empty():
    bst = BinarySearchTree()
    assert bst.pop_max() is None