isleftchild falsecurrent current rightchildif(current =null/end of the linereturn false/didn' find it /end while /found node to delete /continues once we've found the nodewe check first to see whether it has no children when this is true we check the special case of the rootif that' the node to be deletedwe simply set it to nulland this empties the tree otherwisewe set the parent' leftchild or rightchild field to null to disconnect the parent from the node /delete(continued /if no childrensimply delete it if(current leftchild==null &current rightchild==nullif(current =root/if rootroot null/tree is empty else if(isleftchildparent leftchild null/disconnect else /from parent parent rightchild null/continues case the node to be deleted has one child this case isn' so bad either the node has only two connectionsto its parent and to its only child you want to "snipthe node out of this sequence by connecting its parent directly to its child this involves changing the appropriate reference in the parent (leftchild or rightchildto point to the deleted node' child this is shown in figure figure deleting node with one child