minimum key valuethuschanging the pointer as described will maintain bstwith removed the code for this methodnamed deleteminis as followsprivate bstnode deletemin(bstnode rtif (rt left(=nullreturn rt right()else rt setleft(deletemin(rt left()))return rtexample figure illustrates the deletemin process beginning at the root node with value deletemin follows the left link until there is no further left linkin this case reaching the node with value the node with value is changed to point to the right child of the node containing the minimum value this is indicated in figure by dashed line pointer to the node containing the minimum-valued element is stored in parameter the return value of the deletemin method is the subtree of the current node with the minimum-valued node in the subtree removed as with method inserthelpeach node on the path back to the root has its left child pointer reassigned to the subtree resulting from its call to the deletemin method useful companion method is getmin which returns reference to the node containing the minimum value in the subtree private bstnode getmin(bstnode rtif (rt left(=nullreturn rtelse return getmin(rt left())removing node with given key value from the bst requires that we first find and then remove it from the tree sothe first part of the remove operation is search to find once is foundthere are several possibilities if has no childrenthen ' parent has its pointer set to null if has one childthen ' parent has its pointer set to ' child (similar to deleteminthe problem comes if has two children one simple approachthough expensiveis to set ' parent to point to one of ' subtreesand then reinsert the remaining subtree' nodes one at time better alternative is to find value in one of the subtrees that can replace the value in