zoukankan      html  css  js  c++  java
  • 测试图片code

     

    def is_full_binary_tree(tree): # This functions returns that is it full binary tree or not?

    if tree is None:

    return True

    def main(): # Main func for testing.

    tree = Node(1)

    tree.left = Node(2)

    tree.right = Node(3)

    tree.left.left = Node(4)

    tree.left.right = Node(5)

    tree.left.right.left = Node(6)

    tree.right.left = Node(7)

    tree.right.left.left = Node(8)

    tree.right.left.left.right = Node(9)

     

    print(is_full_binary_tree(tree))

    print(depth_of_tree(tree))

    print("Tree is: ")

    display(tree)

     

    if __name__ == '__main__':

    main()

     

     

    if (tree.left is None) and (tree.right is None):

    return True

    if (tree.left is not None) and (tree.right is not None):

    return (is_full_binary_tree(tree.left) and is_full_binary_

     

    def main(): # Main func for testing.

    tree = Node(1)

    tree.left = Node(2)

    tree.right = Node(3)

    tree.left.left = Node(4)

    tree.left.right = Node(5)

    tree.left.right.left = Node(6)

    tree.right.left = Node(7)

    tree.right.left.left = Node(8)

    tree.right.left.left.right = Node(9)

     

    print(is_full_binary_tree(tree))

    print(depth_of_tree(tree))

    print("Tree is: ")

    display(tree)

     

    if __name__ == '__main__':

    main()

     

  • 相关阅读:
    python 自定义去掉空行
    JavaScript 获取时间函数
    python 自定义ssh
    python 去掉空行
    python roboot解析 output.xml
    语音识别-windows
    python 自定义request模块调试
    python 自定义装饰器
    python 自定义Server酱模块编写
    python 自定义exception模块
  • 原文地址:https://www.cnblogs.com/binyang/p/10897340.html
Copyright © 2011-2022 走看看