data structures using return -parent -leftwe can start the deletion process by using the following codewhere the function replace_node substitutes the child into ' place in the tree for conveniencewe assume that null leaves are represented by actual node objectsrather than null void delete_child(struct node * /if has at most one non-null child *struct node *childif (is_leaf( -right)child -leftelse child -rightreplace_node(nchild)if ( -colour =blackif (child -colour =redchild -colour blackelse del_case (child)free( )when both and its parent are blackthen deleting will cause paths which precede through to have one fewer black nodes than the other paths this will violate property thereforethe tree needs to be rebalanced there are several cases to considerwhich are discussed below case is the new root in this casewe have removed one black node from every pathand the new root is blackso none of the properties are violated void del_case (struct node *nif ( -parent !nulldel_case ( )note in cases and we assume is the left child of its parent if it is the right childleft and right should be interchanged throughout these three cases case sibling is red in this caseinterchange the colours of and sand then rotate left at in the resultant trees will become ' grandparent figure illustrates case deletion sl sr sr sl figure deletion in case