示例#1
0
        if int(_inputuser) >= int(tree._height()) or int(_inputuser) < 0:
             print("Depth is not valid, please choose another depth size" )
             continue
        else:
             break
#Depth of tree is read
    k=int(_inputuser)
    depth_file = open("RB_depth.txt", "w+", encoding="utf-8")
    tree._depth(k)
    depth_file.close()

if _input is "1": #AVL Tree
    tree = AVLTree()
    read_file() 
    
    print("Nodes in tree: "+ str(tree._size()))
    print("\n")
    print("Height: " + str(tree._height()))
    
    output_file = open("AVL_tree.txt", "w+", encoding = 'utf-8')
    tree._write()
    output_file.close()
    
    while True:
        _inputuser = input("Please enter the depth of nodes you would like printed to file: ")
        print()
        if int(_inputuser) >= int(tree._height()) or int(_inputuser) < 0:
            print("Depth is not valid, please choose another depth size: ")
            continue
        else:
             break