From 868018cd657055c2caf6f4b72d590e666d322663 Mon Sep 17 00:00:00 2001 From: Georg Hopp Date: Thu, 22 Aug 2013 16:38:29 +0100 Subject: [PATCH] more stuff on rbdelete --- docs/rbdelete.txt | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/rbdelete.txt b/docs/rbdelete.txt index 21b7a59..071d2e4 100644 --- a/docs/rbdelete.txt +++ b/docs/rbdelete.txt @@ -114,27 +114,36 @@ Get an overview over our variables now: Sl: Nullpointer Sr: R(10) -we have case 2 described in Wikipedia (reverse colors of P and S) +cases: + - case 2: S is red => reverse color of P and S, then rotate left at P + - case 3: P, S and S's children are black => repaint S red + - case 4: S and S's children are black, P is red => exchange colors of S and + P + - case 5: S and Sr black, Sl is red N left of P => rotate right at S, exchange + colors of S and Sl + - case 6: S black, Sr is red N left of P => rotate left at P, exchange colors + of P and S and make Sr black + +looks like case 6: + +first rotate left at P B(11) - R(8) R(13) + B(9) R(13) - B(N) B(9) B(12) B(16) + R(8) R(10) B(12) B(16) - B(N) R(10) B(N) B(N) B(N) B(N) + B(N) B(N) B(N) B(N) B(N) B(N) B(N) B(N) - B(N) B(N) - -still case 2 rotate left on P +exchange colors of P and S and make Sr black. B(11) - B(9) R(13) + R(9) R(13) - B(8) R(10) B(12) B(16) - - B(N) B(N) B(N) B(N) B(N) B(N) B(N) B(N) + B(8) B(10) B(12) B(16) + B(N) B(N) B(N) B(N) B(N) B(N) B(N) B(N) # vim: set et ts=4: