Question: Question 4 2 pts Examine the following code to add a node to BST. Logic is correct, but the tree is empty (never being able

 Question 4 2 pts Examine the following code to add a

Question 4 2 pts Examine the following code to add a node to BST. Logic is correct, but the tree is empty (never being able to insert a node). Explain why the following code is not working in your own words. public class SearchTree { private IntTreeNode overall Root; // Adds the given value to this BST in sorted order. // (THIS CODE DOES NOT WORK PROPERLY!) public void add(int value) { add(overall Root, value); } private void add(IntTreeNode node, int value) { if (node == null) { node = new IntTreeNode(value); } else if (value node.data) { add(node.right, value); } 1/ else a duplicate (don't add) } Edit View Insert Format Tools Table 12pt Paragraph B I U Av Av Tav

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!