def do_task(): avl = AvlTree() for value in [10, 20, 30, 40, 50, 25]: avl.insert(value) print('\n size:', avl.size()) print('\n min:', avl.min()) print('\n max:', avl.max()) print('\n contain:', avl.contain(50)) print('\n height:', avl.height()) print('\n print tree') print_tree(avl) print()
def do_task(): a = AvlTree() for value in [10, 20, 30, 40, 50, 25, 100, 28, 140]: a.insert(value) print(' display tree a:') display_tree(a) ########################################### b = a.clone() b.insert(22) b.insert(29) print('\n\n\n display tree b:') display_tree(b) print('\n\n height tree b:', b.height()) ########################################### print('\n\n\n display tree a (again):') display_tree(a) ########################################### c = a.clone() c.clear() print('\n\n\n display tree c:') display_tree(c) print()
def do_task(): avl = AvlTree(lst=[10, 20, 30, 40, 50, 25]) print('\n count:', avl.count()) print('\n min:', avl.min()) print('\n max:', avl.max()) print('\n contain:', avl.contain(50)) print('\n height:', avl.height()) print('\n print tree') print_tree(avl) print()
def do_task(): avl = AvlTree() for value in [10, 20, 30, 40, 50, 25, 100, 28, 140]: print('\n\n\n insert', value) avl.insert(value) print(' height:', avl.height()) print_tree(avl) print() for value in [30, 50, 140, 25, 20, 10, 40, 100, 28]: print('\n\n\n remove', value) avl.remove(value) print(' height:', avl.height()) print_tree(avl) print()
def do_task(): avl = AvlTree(canddrm='left') for value in 'INFORMATIONTECHNOLOGY': print(f'\n\n\n\n insert {value} \n') avl.insert(value) display_tree(avl) print() for value in 'ECI': print(f'\n\n\n\n remove {value} \n') avl.remove(value) display_tree(avl) print()
def do_task(): avl = AvlTree(canddrm='right') for value in [10, 20, 30, 40, 50, 25, 100, 28, 140]: print(f'\n\n\n\n insert {value} \n') avl.insert(value) display_tree(avl) print() for value in [30, 50, 140, 25, 20, 10, 40, 100, 28]: print(f'\n\n\n\n remove {value} \n') avl.remove(value) display_tree(avl) print()