Skip to content

Commit

Permalink
Update red_black_tree.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KPatr1ck authored Nov 25, 2018
1 parent 3b2b98e commit 7935ed6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/26_red_black_tree/red_black_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def _delete_fixup(self, node):
# 注意,因为p可能是红或黑,所以不能直接赋值颜色,只能copy
b.color = p.color # case 4
p.set_black() # case 4
b.left.set_black() # case 4
b.left.set_black() # case 4
self.rotate_r(p) # case 4
# trick, 调整结束跳出while
n = self.root # case 4
Expand Down Expand Up @@ -329,7 +329,7 @@ def rotate_r(self, node):

if node.left is self.black_leaf:
return
# raise Exception('try rotate left , but the node "{}" has no left child'.format(node.val))
# raise Exception('try rotate right , but the node "{}" has no left child'.format(node.val))

p = self.parent(node)
x = node
Expand Down

0 comments on commit 7935ed6

Please sign in to comment.