摘要: 树的遍历 1 class Node: # This is the Class Node with constructor that contains data variable to type data and left,right pointers. 2 def __init__(self, data): 3 self.data = data 4 ... 阅读全文
posted @ 2019-05-21 01:06 binyang 阅读(173) 评论(0) 推荐(0) 编辑
摘要: classNode:# This is the Class Node with constructor that contains data variable to type data and left,right pointers.def __init__(self, data):self.data = dataself.left... 阅读全文
posted @ 2019-05-21 00:31 binyang 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 测试代码表现 1 def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree. 2 if tree is None: 3 return 0 4 else: 5 depth_l_tree = depth_of_tree(tr... 阅读全文
posted @ 2019-05-21 00:20 binyang 阅读(288) 评论(0) 推荐(0) 编辑
摘要: def display(tree):#In Order traversal of the treeif tree isNone: returnif tree.left isnotNone:display(tree.left)print(tree.data)if tree.right isnotNon... 阅读全文
posted @ 2019-05-21 00:14 binyang 阅读(363) 评论(0) 推荐(0) 编辑