We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 15bc87f commit 56de3dfCopy full SHA for 56de3df
binary_tree/basic_binary_tree.py
@@ -4,6 +4,20 @@ def __init__(self, data):
4
self.left = None
5
self.right = None
6
7
+def display(tree): #In Order traversal of the tree
8
+
9
+ if tree is None:
10
+ return
11
12
+ if tree.left is not None:
13
+ display(tree.left)
14
15
+ print(tree.data)
16
17
+ if tree.right is not None:
18
+ display(tree.right)
19
20
21
22
def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree.
23
if tree is None:
@@ -41,6 +55,8 @@ def main(): # Main func for testing.
41
55
42
56
print(is_full_binary_tree(tree))
43
57
print(depth_of_tree(tree))
58
+ print("Tree is: ")
59
+ display(tree)
44
60
45
61
46
62
if __name__ == '__main__':
0 commit comments