RB-Delete-Fixup(T,x) while x <> root(T) and color(x) = Black if x = left(parent(x)) then s = right(parent(x)) ; Get x's sibling if color(s) = Red then color(s) = Black ; Case I color(parent(x)) = Red Left-Rotate(T, parent(x)) s = right(parent(x)) if color(left(s)) = Black and color(right(s)) = Black then color(s) = Red ; Case II x = parent(x) else if color(right(s)) = Black then color(left(s)) = Black ; Case III color(s) = Red Right-Rotate(T,s) s = right(parent(x)) color(s) = color(parent(x)) ; Case IV color(parent(x)) = Black color(right(s)) = Black Left-Rotate(T, parent(x)) x = root(T) else ... ; Same as then with right and left swapped color(x) = Black
RBT Example