Esempio n. 1
0
# myList.display()
# print()
# myList.delete_first()
# myList.display()
# print()
# myList.delete(8)
# myList.display()
# print()
# print(myList.size)

# Binary Search Tree
print('*****Binary search tree testing*****')
my_tree = BinarySearchTree()
root = None
root = my_tree.insert(root, 3)
my_tree.insert(root, 7)
my_tree.insert(root, 1)
my_tree.insert(root, 5)
my_tree.insert(root, 10)
print('in order')
my_tree.display_in_order(root)
print('pre order')
my_tree.display_pre_order(root)
print('post order')
my_tree.display_post_order(root)
val = 7
print('contains', val, my_tree.contains(root, val))
val = 2
print('contains', val, my_tree.contains(root, val))
val = 10
print('contains', val, my_tree.contains(root, val))