Write a program to evaluate empirically the following strategies for removing no
ID: 674532 • Letter: W
Question
Write a program to evaluate empirically the following strategies for removing nodes
with two children:
a. Replace with the largest node,X, inTL and recursively remove X.
b. Alternately replace with the largest node in TL and the smallest node in TR, and recursively remove the appropriate node.
c. Replace with either the largest node in TL or the smallest node in TR (recursively removing the appropriate node), making the choice randomly.
Which strategy seems to give the most balance? Which takes the least CPU time to process the entire sequence?
Explanation / Answer
+ 3 means inserting 3 into the current BST.
- 5 means removing 5 from the current BST if 5 is in the BST.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.