mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
parent
20c2db0de4
commit
6043a44ffb
|
@ -1,4 +1,4 @@
|
||||||
class Node: # This is the Class Node with constructor that contains data variable to type data and left,right pointers.
|
class Node: # This is the Class Node with a constructor that contains data variable to type data and left, right pointers.
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.data = data
|
self.data = data
|
||||||
self.left = None
|
self.left = None
|
||||||
|
@ -37,7 +37,7 @@ def depth_of_tree(
|
||||||
|
|
||||||
def is_full_binary_tree(
|
def is_full_binary_tree(
|
||||||
tree,
|
tree,
|
||||||
): # This functions returns that is it full binary tree or not?
|
): # This function returns that is it full binary tree or not?
|
||||||
if tree is None:
|
if tree is None:
|
||||||
return True
|
return True
|
||||||
if (tree.left is None) and (tree.right is None):
|
if (tree.left is None) and (tree.right is None):
|
||||||
|
@ -48,7 +48,7 @@ def is_full_binary_tree(
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def main(): # Main func for testing.
|
def main(): # Main function for testing.
|
||||||
tree = Node(1)
|
tree = Node(1)
|
||||||
tree.left = Node(2)
|
tree.left = Node(2)
|
||||||
tree.right = Node(3)
|
tree.right = Node(3)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user