Question: Modify the DeleteNode function so that it uses the immediate successor (rather than the predecessor) of the value to be deleted in the case of
Modify the DeleteNode function so that it uses the immediate successor (rather than the predecessor) of the value to be deleted in the case of deleting a node with two children. You should call the function PtrToSuccessor that you wrote in Exercise 21.
Exercise 21
Write a function called PtrToSuccessor that finds a node with the smallest key value in a tree, unlinks it from the tree, and returns a pointer to the unlinked node.
Step by Step Solution
3.44 Rating (157 Votes )
There are 3 Steps involved in it
Lets focus on writing the PtrToSuccessor function first In a binary search tree the smallest key value is always at the far left of the tree Therefore ... View full answer
Get step-by-step solutions from verified subject matter experts
