Recently , I'm learning the Left Lean Red Black Tree. And I red this to help me learn . However , I can not get the meaning of the codes in the delete operation, they are :
if (isRed(h.left))h = rotateRight(h);
I just can't find a good example to help me to get the usage of this code.
Can anybody helps to give me the reason why the code should be there (with a tiny example is much better) ?
Page 7 of the PDF contains the full function. Basically what it is doing, if the line is "red" (meaning it was added to force the tree to be a LLRBT), then rotate the left child node in it's place.
If I'm deleting A, I'd rotate B to it's place: