Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Help Which action is appropriate when trying to remove a node which has a l

ID: 3559376 • Letter: J

Question

Java Help

Which action is appropriate when trying to remove a node which has a left leaf child?

a. Repalce the node by its left child
b. Do not replace the node
c. Replace the node by its right child
d. Replace the node by the sibling of the leaf child

Consider the TreeSearch(k, v) method has been called on a leaf node v. How many recursive calls will the TreeSearch() method perform?

a. As many as the height of the tree
b. As many leaves in the tree
c. 1
d. 0

What are the possible running times of the find(k) methods in binary search trees? (Choose all that apply)

a. where n is the number of nodes in the tree.
b. O(n) where n is the number of nodes in the tree
c. O(log n) where n is the number of nodes in the tree
d. where n is the number of nodes in the tree

Explanation / Answer

1.) d. Replace the node by the sibling of the leaf child

2.) a. As many as the height of the tree

3.) c. O(log n) where n is the number of nodes in the tree

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote