Multiple Choice
Given the BinarySearchTree and Node classes discussed in section 17.3 (partially shown below) , select an expression to complete the recursive method smallest in the Node class. The method returns the smallest data value in the binary search tree rooted at a node. public class BinarySearchTree
{
Private Node root;
Public BinarySearchTree() {...}
Public void add(Comparable obj) {...}
Public Comparable smallest()
{
If (root == null)
Throw new NoSuchElementException() ;
Else
Return root.smallest() ;
}
Class Node
{
Public Comparable data;
Public Node left;
Public Node right;
Public Comparable smallest()
{
If (left == null)
Return data;
Else
Return _______________;
}
}
}
A) left.smallest()
B) right.smallest()
C) data.smallest()
D) Math.min(left.smallest() , right.smallest() )
Correct Answer:

Verified
Correct Answer:
Verified
Q93: If we have a heap with n
Q94: Consider the following tree diagrams: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB7390/.jpg"
Q95: Removing an element from a balanced binary
Q96: Adding an element to an unbalanced binary
Q97: Which action(s) will invalidate a min-heap so
Q99: Consider the following binary search tree diagram:
Q100: Given the MinHeap class discussed in section
Q101: Which of the following is NOT a
Q102: Consider the following tree diagrams: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB7390/.jpg"
Q103: Consider the following binary search tree diagram: