
Introduction:
Please refer the introduction of RBT here. So, we now know the invariants or properties of RBT which make it rbt :)
Insertion of element in RBT or red black tree breaks one of the 4 invariants or properties. So we have to fix it in minimal possible way. To assist us with we have 2 solutions :
Flipping the color
Right and left rotation
Insertion:
Insertion begins by adding the node much as binary search tree insertion does and by coloring it red. The insertion of red node can cause red violation so we are going to fix it after...