| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 6f65106 commit 2c67f61
1 file changed
| Original file line number | Diff line number | Diff 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. | ||
| 2 | 2 | def __init__(self, data): | |
| 3 | 3 | self.data = data | |
| 4 | 4 | self.left = None | |
| 5 | 5 | self.right = None | |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | - def depth_of_tree(tree): | ||
| 8 | + def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree. | ||
| 9 | 9 | if tree is None: | |
| 10 | 10 | return 0 | |
| 11 | 11 | else: | |
@@ -17,7 +17,7 @@ def depth_of_tree(tree): | |||
| 17 | 17 | return 1 + depth_r_tree | |
| 18 | 18 | ||
| 19 | 19 | ||
| 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? | ||
| 21 | 21 | if tree is None: | |
| 22 | 22 | return True | |
| 23 | 23 | if (tree.left is None) and (tree.right is None): | |
@@ -28,7 +28,7 @@ def is_full_binary_tree(tree): | |||
| 28 | 28 | return False | |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | - def main(): | ||
| 31 | + def main(): # Main func for testing. | ||
| 32 | 32 | tree = Node(1) | |
| 33 | 33 | tree.left = Node(2) | |
| 34 | 34 | tree.right = Node(3) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments