figure insertion in case note that in case is the right child of and is the right child of gwe perform left rotation in the code that handles case we check for and and thenperform either left or right rotation void case (struct node *nstruct node *gg grandparent( )if (( = -parent -left&( -parent = -left)rotate_right( )else if (( = -parent -right&( -parent = -right)rotate_left( ) -parent -colour blackg -colour reddeleting node from red-black tree we start deleting node from red-black tree in the same way as we do in case of binary search tree in binary search treewhen we delete node with two non-leaf childrenwe find either the maximum element in its left sub-tree of the node or the minimum element in its right sub-treeand move its value into the node being deleted after thatwe delete the node from which we had copied the value note that this node must have less than two non-leaf children thereforemerely copying value does not violate any red-black propertiesbut it just reduces the problem of deleting to the problem of deleting node with at most one non-leaf child in this sectionwe will assume that we are deleting node with at most one non-leaf childwhich we will call its child in case this node has both leaf childrenthen let one of them be its child while deleting nodeif its colour is redthen we can simply replace it with its childwhich must be black all paths through the deleted node will simply pass through one less red nodeand both the deleted node' parent and child must be blackso none of the properties will be violated another simple case is when we delete black node that has red child in this caseproperty and property could be violatedso to restore themjust repaint the deleted node' child with black howevera complex situation arises when both the node to be deleted as well as its child is black in this casewe begin by replacing the node to be deleted with its child in the codewe label the child node as (in its new positionnand its sibling (its new parent' other childas the code to find the sibling of node can be given as followsstruct node *sibling(struct node *nif ( = -parent -leftreturn -parent -rightelse