experiment color flips start with the position of figure with nodes and inserted in addition to in the root position note that the parent (the rootis black and both its children are red now try to insert another node no matter what value you useyou'll see the message can' insertneeds color flip as we mentioneda color flip is necessary wheneverduring the insertion processa black node with two red children is encountered the red arrow should already be positioned on the black parent (the root node)so click the flip button the root' two children change from red to black ordinarilythe parent would change from black to redbut this is special case because it' the rootit remains black to avoid violating rule now all three nodes are black the tree is still red-black correct now click the ins button again to insert the new node figure shows the result if the newly inserted node has the key value figure colors flippednew node inserted the tree is still red-black correct the root is blackthere' no situation in which parent and child are both redand all the paths have the same number of black nodes (twoadding the new red node didn' change the red-black correctness experiment an unbalanced tree now let' see what happens when you try to do something that leads to an unbalanced tree in figure one path has one more node than the other this isn' very unbalancedand no red-black rules are violatedso neither we nor the red-black algorithms need to worry about it howeversuppose that one path differs from another by two or more levels (where level is the same as the number of nodes along the pathin this case the red-black rules will always be violatedand we'll need to rebalance the tree insert into the tree of figure you'll see the message errorparent and child are both red rule has been violatedas shown in figure