Question: Consider the following implementation of the contains method. How does it differ from the one we showed in Section 17.4 ? Is it better or
Consider the following implementation of the contains method. How does it differ from the one we showed in Section 17.4 ? Is it better or worse, and why?

private boolean contains (IntTreeNode root, int value) { if (root = null) ( return false; } else if (value == root.data) { return true; } else { return contains (root.left, value) || contains (root.right, value);
Step by Step Solution
3.50 Rating (160 Votes )
There are 3 Steps involved in it
This second version of contains is much less efficient than the on... View full answer
Get step-by-step solutions from verified subject matter experts
