Skip to content

Commit 2c67f61

Browse files
AkashAli506poyea
authored andcommitted
Update basic_binary_tree.py (TheAlgorithms#725)
I have added the comments for better understanding.
1 parent 6f65106 commit 2c67f61

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

binary_tree/basic_binary_tree.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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)

0 commit comments

Comments
 (0)