chap binary trees figure an example of bst insertion record with value is inserted into the bst of figure (athe node with value becomes the parent of the new node containing you should pay careful attention to the implementation for inserthelp note that inserthelp returns pointer to bstnode what is being returned is subtree identical to the old subtreeexcept that it has been modified to contain the new record being inserted each node along path from the root to the parent of the new node added to the tree will have its appropriate child pointer assigned to it except for the last node in the pathnone of these nodes will actually change their child' pointer value in that sensemany of the assignments seem redundant howeverthe cost of these additional assignments is worth paying to keep the insertion process simple the alternative is to check if given assignment is necessarywhich is probably more expensive than the assignmentthe shape of bst depends on the order in which elements are inserted new element is added to the bst as new leaf nodepotentially increasing the depth of the tree figure illustrates two bsts for collection of values it is possible for the bst containing nodes to be chain of nodes with height this would happen iffor exampleall elements were inserted in sorted order in generalit is preferable for bst to be as shallow as possible this keeps the average cost of bst operation low removing node from bst is bit trickier than inserting nodebut it is not complicated if all of the possible cases are considered individually before tackling the general node removal processlet us first discuss how to remove from given subtree the node with the smallest key value this routine will be used later by the general node removal function to remove the node with the minimum key value from subtreefirst find that node by continuously moving down the left link until there is no further left link to follow call this node to remove ssimply have the parent of change its pointer to point to the right child of we know that has no left child (because if did have left childs would not be the node with