A python package to make a Tree's like a Binary Tree and Balanced AVL Tree.
Use:
pip install Py-AVL-Tree
First, import the AVL class.
fromTreeAVL.AVLimportAVLNow, you have to parse a list with nodes to create a object tree.
fromTreeAVL.AVLimportAVLtree=AVL([10, 5, 15, 7, 18, 9])To show your binary tree, just parse your new object tree to print.
fromTreeAVL.AVLimportAVLtree=AVL([10, 5, 15, 7, 18, 9])
print(tree)If you have to balance your tree, just call the method BalanceTree()
fromTreeAVL.AVLimportAVLtree=AVL([10, 5, 15, 7, 18, 9])
print(tree)
tree.BalanceTree()
print(tree)