@@ -76,7 +76,7 @@ def insert(self, *values):
76
76
77
77
def search (self , value ):
78
78
if self .empty ():
79
- raise IndexError ("Warning: Tree is empty! please use another. " )
79
+ raise IndexError ("Warning: Tree is empty! please use another." )
80
80
else :
81
81
node = self .root
82
82
# use lazy evaluation here to avoid NoneType Attribute error
@@ -153,7 +153,7 @@ def postorder(curr_node):
153
153
154
154
155
155
def binary_search_tree ():
156
- r """
156
+ """
157
157
Example
158
158
8
159
159
/ \
@@ -163,15 +163,15 @@ def binary_search_tree():
163
163
/ \ /
164
164
4 7 13
165
165
166
- >>> t = BinarySearchTree().insert(8, 3, 6, 1, 10, 14, 13, 4, 7)
167
- >>> print(" ".join(repr(i.value) for i in t.traversal_tree()))
168
- 8 3 1 6 4 7 10 14 13
169
- >>> print(" ".join(repr(i.value) for i in t.traversal_tree(postorder)))
170
- 1 4 7 6 3 13 14 10 8
171
- >>> BinarySearchTree().search(6)
172
- Traceback (most recent call last):
173
- ...
174
- IndexError: Warning: Tree is empty! please use another.
166
+ >>> t = BinarySearchTree().insert(8, 3, 6, 1, 10, 14, 13, 4, 7)
167
+ >>> print(" ".join(repr(i.value) for i in t.traversal_tree()))
168
+ 8 3 1 6 4 7 10 14 13
169
+ >>> print(" ".join(repr(i.value) for i in t.traversal_tree(postorder)))
170
+ 1 4 7 6 3 13 14 10 8
171
+ >>> BinarySearchTree().search(6)
172
+ Traceback (most recent call last):
173
+ ...
174
+ IndexError: Warning: Tree is empty! please use another.
175
175
"""
176
176
testlist = (8 , 3 , 6 , 1 , 10 , 14 , 13 , 4 , 7 )
177
177
t = BinarySearchTree ()
@@ -204,4 +204,4 @@ def binary_search_tree():
204
204
import doctest
205
205
206
206
doctest .testmod ()
207
- binary_search_tree ()
207
+ # binary_search_tree()
0 commit comments