-1

If I want to delete the 64 node from this Red Black Tree, I do the following:

https://i.stack.imgur.com/hAFy9.jpg

However, the visualization applet I'm using comes to this as result:

https://i.stack.imgur.com/3vFaS.jpg

Now I assume that they color 12 red after I make the 52 red, which then requires restructuring as they do. But why can't I simply make 52 black to maintain the black depth property? Isn't my final solution also correct?

user3125591
  • 113
  • 5
  • 13

1 Answers1

0

No. In your solution, 54 has left black height 1 and right black height 0, making it invalid.

jbapple
  • 3,297
  • 1
  • 24
  • 38
  • Thank you, that also makes sense and I never knew that was a property of the red black tree! :) I think I understand why they did it like that now I re-read the part in my book again. Thanks. – user3125591 Sep 28 '14 at 22:02