def __str__(self): return pretty_tree(self)
elif tree_type == 'RBT': myTree = RedBlackTree() if myTree is not None: tree = english_words(myTree) counter = 0 tree = AVLTree() for ln in word_list: if counter == 10000: break ln = ln.replace('\n', '') ln = Node(ln) tree.insert(ln) counter += 1 print(pretty_tree(tree)) if tree_type == 'AVL': tree_AVL = AVLTree() for ln in word_list: ln = ln.replace('\n', '') words = Node(ln) tree_AVL.insert(words) print(tree_AVL) if tree_type == 'RBT': tree_RBT = RedBlackTree() for ln in word_list: tree_RBT.insert(ln) print('tree has height ' + str(tree_RBT.get_height()))