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

1 Expert Approved Answer
Step: 1 Unlock

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

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Language Pragmatics Questions!