figure outside grandchild on the way down the procedure used to fix this is similar to the post-insertion operation with an outside grandchilddescribed earlier we must perform two color switches and one rotation so we can discuss this in the same terms we did when inserting nodewe'll call the node at the top of the triangle that was flipped (which is in this casex this looks little oddbecause we're used to thinking of as the node being insertedand here it' not even leaf node howeverthese on-the-way-down rotations can take place anywhere within the tree the parent of is ( in this case)and the grandparent of --the parent of --is ( in this casewe follow the same set of rules we did under possibility discussed above switch the color of ' grandparent ( in this exampleignore the message that the root must be black switch the color of ' parent ( rotate with ' grandparent ( at the topin the direction that raises (here right rotationsuddenlythe tree is balancedit has also become pleasantly symmetrical it appears to be bit of miraclebut it' only result of following the color rules now the node with value can be inserted in the usual way because the node it connects to is blackthere' no complexity about the insertion one color flip (at is necessary figure shows the tree after is inserted inside grandchild if is an inside grandchild when red-red conflict occurs on the way downtwo rotations are required to set it right this situation is similar to the inside grandchild in the postinsertion phasewhich we called possibility click start in the rbtree workshop applet to begin with and insert and you'll need color flips before and