figure deleting node node without children the node to be deleted has no children (see figure the node to be deleted has only one child (see figure the node to be deleted has two children (see figure the first case is straightforward if the current node has no children all we need to do is delete the node and remove the reference to this node in the parent the code for this case is shown in here if current_node is_leaf()if current_node =current_node parent left_childcurrent_node parent left_child none elsecurrent_node parent right_child none the second case is only slightly more complicated if node has only single childthen we can simply promote the child to take the place of its parent the code for this case is shown below as you look at this code you will see that there are six cases to consider since the cases are symmetric with respect to either having left or right child we will just discuss the case where the current node has left child the decision proceeds as follows if the current node is left child then we only need to update the parent reference of the left child to point to the parent of the current nodeand then update the left child reference of the parent to point to the current node' left child if the current node is right child then we only need to update the parent reference of the right child to point to the parent of the current nodeand then update the right child reference of the parent to point to the current node' right child if the current node has no parentit must be the root in this case we will just replace the key,payloadleft_childand right_child data by calling the replace_node_data method on the root elsethis node has one child trees and tree algorithms