deletion removing node from bst is fairly straightforwardwith four cases to consider the value to remove is leaf nodeor the value to remove has right subtreebut no left subtreeor the value to remove has left subtreebut no right subtreeor the value to remove has both left and right subtree in which case we promote the largest value in the left subtree there is also an implicit fifth case whereby the node to be removed is the only node in the tree this case is already covered by the firstbut should be noted as possibility nonetheless of course in bst value may occur more than once in such case the first occurrence of that value in the bst will be removed # right subtree and left subtree # left subtree no right subtree # right subtree no left subtree # leaf node figure binary search tree deletion cases the remove algorithm given below relies on two further helper algorithms named indp arentand indn ode which are described in ss and ss respectively