Exemplo n.º 1
0
def heightrandom():
    for i in range(2, 10, 2):
        L = [100 * random() for x in range((2**i) - 1)]
        BSTTree = BST()
        TreapTree = Treap()
        for x in L:
            BSTTree.insert(x)
            TreapTree.insert(x)
        print("Complete Tree would have height of", i - 1)
        print("Height of BST is: ", BSTTree.height())
        print("Height of Treap is: ", TreapTree.height())