equivalent to the findhelp function of the bst class note that kd class private member stores the key' dimension private findhelp(kdnode rtint[keyint levelif (rt =nullreturn nulle it rt element()int[itkey rt key()if ((itkey[ =key[ ]&(itkey[ =key[ ])return rt element()if (itkey[levelkey[level]return findhelp(rt left()key(level+ )% )else return findhelp(rt right()key(level+ )% )inserting new node into the - tree is similar to bst insertion the - tree search procedure is followed until null pointer is foundindicating the proper place to insert the new node example inserting record at location ( in the - tree of figure first requires search to the node containing record at this pointthe new record is inserted into ' left subtree deleting node from - tree is similar to deleting from bstbut slightly harder as with deleting from bstthe first step is to find the node (call it nto be deleted it is then necessary to find descendant of which can be used to replace in the tree if has no childrenthen is replaced with null pointer note that if has one child that in turn has childrenwe cannot simply assign ' parent to point to ' child as would be done in the bst to do so would change the level of all nodes in the subtreeand thus the discriminator used for search would also change the result is that the subtree would no longer be - tree because node' children might now violate the bst property for that discriminator similar to bst deletionthe record stored in should be replaced either by the record in ' right subtree with the least value of ' discriminatoror by the record in ' left subtree with the greatest value for this discriminator assume that was at an odd level and therefore is the discriminator could then be replaced by the record in its right subtree with the least value (call it ymin the problem is that ymin is not necessarily the leftmost nodeas it would be in the bst modified search procedure to find the least value in the left subtree must be used to find it instead the implementation for findmin is shown in figure recursive call to the delete routine will then remove ymin from the tree finallyymin ' record is substituted for the record in node