From 7935ed66ec4aabb0fc7c2e7a8914d5bcd6c92dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A0=91=E5=93=A5?= <109694228@qq.com> Date: Sun, 25 Nov 2018 16:18:57 +0800 Subject: [PATCH] Update red_black_tree.py --- python/26_red_black_tree/red_black_tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/26_red_black_tree/red_black_tree.py b/python/26_red_black_tree/red_black_tree.py index d3e1060..ed67017 100644 --- a/python/26_red_black_tree/red_black_tree.py +++ b/python/26_red_black_tree/red_black_tree.py @@ -253,7 +253,7 @@ class RedBlackTree: # 注意,因为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 @@ -329,7 +329,7 @@ class RedBlackTree: 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