Skip to content

Commit

Permalink
fixed bug in binarysearchtree.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush1997 committed Oct 25, 2016
1 parent 21945f6 commit fb232f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions trees/binarysearchtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@ def insert(self, value):
else:
node = self.root
while node and node.value != value:
if node.value == value:
return
parent = node
if node.value < value:
node = node.right
else:
node = node.left
if node.value == value:
return
if parent.value > value:
parent.left = new_node
else:
Expand Down

0 comments on commit fb232f7

Please sign in to comment.