File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1- class Node :
1+ class Node : # This is the Class Node with constructor that contains data variable to type data and left,right pointers.
22 def __init__ (self , data ):
33 self .data = data
44 self .left = None
55 self .right = None
66
77
8- def depth_of_tree (tree ):
8+ def depth_of_tree (tree ): #This is the recursive function to find the depth of binary tree.
99 if tree is None :
1010 return 0
1111 else :
@@ -17,7 +17,7 @@ def depth_of_tree(tree):
1717 return 1 + depth_r_tree
1818
1919
20- def is_full_binary_tree (tree ):
20+ def is_full_binary_tree (tree ): # This functions returns that is it full binary tree or not?
2121 if tree is None :
2222 return True
2323 if (tree .left is None ) and (tree .right is None ):
@@ -28,7 +28,7 @@ def is_full_binary_tree(tree):
2828 return False
2929
3030
31- def main ():
31+ def main (): # Main func for testing.
3232 tree = Node (1 )
3333 tree .left = Node (2 )
3434 tree .right = Node (3 )
You can’t perform that action at this time.
0 commit comments