sec binary search trees figure an example of removing the value from the bst the node containing this value has two children we replace value with the least value from the node' right subtreein this case /*remove node with key value @return the tree with the node removed *private bstnode removehelp(bstnode rtkey kif (rt =nullreturn nullif (rt key(compareto( rt setleft(removehelp(rt left() ))else if (rt key(compareto( rt setright(removehelp(rt right() ))else /found it if (rt left(=nullreturn rt right()else if (rt right(=nullreturn rt left()else /two children bstnode temp getmin(rt right())rt setelement(temp element())rt setkey(temp key())rt setright(deletemin(rt right()))return rtfigure implementation for the bst removehelp method from the right subtree does not have similar problembecause it does not violate the binary search tree property if equal values appear in the right subtree from the abovewe see that if we want to remove the record stored in node with two childrenthen we simply call deletemin on the node' right subtree and substitute the record returned for the record being removed figure shows is the code for removehelp the cost for findhelp and inserthelp is the depth of the node found or inserted the cost for removehelp is the depth of the node being removedor