We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3972dd commit 817c274Copy full SHA for 817c274
data_structures/Binary Tree/binary_seach_tree.py
@@ -1,6 +1,8 @@
1
'''
2
A binary search Tree
3
4
+
5
6
class Node:
7
8
def __init__(self, label):
@@ -34,7 +36,7 @@ def __init__(self):
34
36
35
37
def insert(self, label):
38
- #Create a new Node
39
+ # Create a new Node
40
41
node = Node(label)
42
@@ -45,7 +47,7 @@ def insert(self, label):
45
47
curr_node = self.root
46
48
49
while True:
- if curr_node != None:
50
+ if curr_node is not None:
51
52
dad_node = curr_node
53
@@ -61,12 +63,12 @@ def insert(self, label):
61
63
break
62
64
65
def empty(self):
- if self.root == None:
66
+ if self.root is None:
67
return True
68
return False
69
70
def preShow(self, curr_node):
71
+ if curr_node is None:
72
print(curr_node.getLabel(), end=" ")
73
74
self.preShow(curr_node.getLeft())
0 commit comments