UNB/ CS/ David Bremner/ teaching/ cs3383/ lectures/ 20.0-demos/ print tree.py
#!/usr/bin/env python3
def print_tree(tree,root=None,depth=0):
    if root == None:
        root = len(tree)-1

    (weight,left,right)=tree[root]
    print('{1:>{0}d}'.format(depth+6,weight))
    if (left != None):
        print_tree(tree,left,depth+2)
    if (right != None):
        print_tree(tree,right,depth+2)