Resolve --flake-- issues

pull/1140/head
santhoshtk 2023-01-13 18:24:51 +05:30
parent fe68d4d12b
commit efcc523e78
1 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ class BinaryTree:
def __init__(self): def __init__(self):
self.root = None self.root = None
def insert(self, value: int) -> str: def insert(self, data: int) -> str:
""" """
Create a `BinaryTreeNode` with the `value` and insert the node at the Create a `BinaryTreeNode` with the `value` and insert the node at the
vacant place in the Binary Tree. vacant place in the Binary Tree.
@ -39,11 +39,11 @@ class BinaryTree:
NOTE : The vacant place can be found using level order traversal. NOTE : The vacant place can be found using level order traversal.
Also, we need queue for level order traversal. Also, we need queue for level order traversal.
:param value: The value of the `BinaryTreeNode`. :param data: The value of the `BinaryTreeNode`.
:return: A meaningful message to the user of the program. :return: A meaningful message to the user of the program.
""" """
if not self.root: if not self.root:
self.root = BinaryTreeNode(value) self.root = BinaryTreeNode(data)
else: else:
# Creating the FIFO (Queue) for level order traversal # Creating the FIFO (Queue) for level order traversal
auxQueue: Queue = Queue() auxQueue: Queue = Queue()
@ -54,13 +54,13 @@ class BinaryTree:
# Check if current node has vacant place. # Check if current node has vacant place.
if currentNode.leftChild is None: if currentNode.leftChild is None:
currentNode.leftChild = BinaryTreeNode(value) currentNode.leftChild = BinaryTreeNode(data)
break break
else: else:
auxQueue.put(currentNode.leftChild) auxQueue.put(currentNode.leftChild)
if currentNode.rightChild is None: if currentNode.rightChild is None:
currentNode.rightChild = BinaryTreeNode(value) currentNode.rightChild = BinaryTreeNode(data)
break break
else: else:
auxQueue.put(currentNode.rightChild) auxQueue.put(currentNode.rightChild)
@ -155,7 +155,7 @@ class IterativeTraversal(BinaryTree):
return "The Binary Tree is Empty." return "The Binary Tree is Empty."
else: else:
auxStack: list = [] auxStack: list = []
previous: BinaryTreeNode previous = BinaryTreeNode
currentNode = self.root currentNode = self.root
while currentNode or auxStack: while currentNode or auxStack: