let' assume we're using the workshop on the tree in figure and deleting node which has left child but no right child press del and enter when prompted keep pressing del until the arrow rests on node has only one child it doesn' matter whether has children of its ownin this caseit has one pressing del once more causes to be deleted its place is taken by its left child in factthe entire subtree of which is the root is moved up and plugged in as the new right child of use the workshop applet to generate new trees with one-child nodesand see what happens when you delete them look for the subtree whose root is the deleted node' child no matter how complicated this subtree isit' simply moved up and plugged in as the new child of the deleted node' parent java code to delete node with one child the following code shows how to deal with the one-child situation there are four variationsthe child of the node to be deleted may be either left or right childand for each of these cases the node to be deleted may be either the left or right child of its parent there is also specialized situationthe node to be deleted may be the rootin which case it has no parent and is simply replaced by the appropriate subtree here' the code (which continues from the end of the no-child code fragment shown earlier)/delete(continued /if no right childreplace with left subtree else if(current rightchild==nullif(current =rootroot current leftchildelse if(isleftchild/left child of parent parent leftchild current leftchildelse /right child of parent parent rightchild current leftchild/if no left childreplace with right subtree else if(current leftchild==nullif(current =rootroot current rightchildelse if(isleftchild/left child of parent parent leftchild current rightchildelse /right child of parent parent rightchild current rightchild/continued notice that working with references makes it easy to move an entire subtree you do this by simply disconnecting the old reference to the subtree and creating new reference to it somewhere else although there may be lots of nodes in the subtreeyoudon' need to worry about moving them individually in factthey only "movein the sense of being conceptually in different positions relative to the other nodes as far as the program is concernedonly the reference to the root of the subtree has changed