Question: / / remove all nodes that have only one child by promoting that child / / repeat this recursively as you go up , so
remove all nodes that have only one child by "promoting" that child
repeat this recursively as you go up so the final result should have no nodes with only one child
if you start with the tree is unchanged.
if you start with the tree is unchanged.
if you start with the BST then the result is the tree
if you start with the BST then the result is the tree
Hint: This requires that you check for "singleness" after the recursive calls
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
