From 2c67f6161ca4385d9728951f71c4d11fda2ef7df Mon Sep 17 00:00:00 2001 From: Akash Ali <45498607+AkashAli506@users.noreply.github.com> Date: Thu, 7 Mar 2019 20:53:29 +0500 Subject: [PATCH] Update basic_binary_tree.py (#725) I have added the comments for better understanding. --- binary_tree/basic_binary_tree.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/binary_tree/basic_binary_tree.py b/binary_tree/basic_binary_tree.py index 6cdeb1a69..5738e4ee1 100644 --- a/binary_tree/basic_binary_tree.py +++ b/binary_tree/basic_binary_tree.py @@ -1,11 +1,11 @@ -class Node: +class Node: # This is the Class Node with constructor that contains data variable to type data and left,right pointers. def __init__(self, data): self.data = data self.left = None self.right = None -def depth_of_tree(tree): +def depth_of_tree(tree): #This is the recursive function to find the depth of binary tree. if tree is None: return 0 else: @@ -17,7 +17,7 @@ def depth_of_tree(tree): return 1 + depth_r_tree -def is_full_binary_tree(tree): +def is_full_binary_tree(tree): # This functions returns that is it full binary tree or not? if tree is None: return True if (tree.left is None) and (tree.right is None): @@ -28,7 +28,7 @@ def is_full_binary_tree(tree): return False -def main(): +def main(): # Main func for testing. tree = Node(1) tree.left = Node(2) tree.right = Node(3)