mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 05:21:09 +00:00
fix some style errors
This commit is contained in:
parent
a3972dd9b4
commit
817c27462b
|
@ -1,6 +1,8 @@
|
||||||
'''
|
'''
|
||||||
A binary search Tree
|
A binary search Tree
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
class Node:
|
class Node:
|
||||||
|
|
||||||
def __init__(self, label):
|
def __init__(self, label):
|
||||||
|
@ -34,7 +36,7 @@ class BinarySearchTree:
|
||||||
|
|
||||||
def insert(self, label):
|
def insert(self, label):
|
||||||
|
|
||||||
#Create a new Node
|
# Create a new Node
|
||||||
|
|
||||||
node = Node(label)
|
node = Node(label)
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ class BinarySearchTree:
|
||||||
curr_node = self.root
|
curr_node = self.root
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if curr_node != None:
|
if curr_node is not None:
|
||||||
|
|
||||||
dad_node = curr_node
|
dad_node = curr_node
|
||||||
|
|
||||||
|
@ -61,12 +63,12 @@ class BinarySearchTree:
|
||||||
break
|
break
|
||||||
|
|
||||||
def empty(self):
|
def empty(self):
|
||||||
if self.root == None:
|
if self.root is None:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def preShow(self, curr_node):
|
def preShow(self, curr_node):
|
||||||
if curr_node != None:
|
if curr_node is None:
|
||||||
print(curr_node.getLabel(), end=" ")
|
print(curr_node.getLabel(), end=" ")
|
||||||
|
|
||||||
self.preShow(curr_node.getLeft())
|
self.preShow(curr_node.getLeft())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user