Multiple Choice
Given the MinHeap class discussed in section 17.6, select the statement(s) needed to complete the following method, which displays the n smallest values in the parameter array. public static void nSmallestValues(Comparable[] array, int n)
{
MinHeap h = new MinHeap() ;
For(Comparable value : array)
{
h.add(value) ;
}
System.out.print(n + " smallest value(s) : ") ;
For(int i = 0; i < n; ++i)
{
___________________________
}
}
A) System.out.println(h.remove() ) ;
B) System.out.println(h.peek() ) ;
C) System.out.println(array[i]) ;
D) System.out.println(h.elements.get(i) ) ;
Correct Answer:

Verified
Correct Answer:
Verified
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
Q98: Given the BinarySearchTree and Node classes discussed
Q99: Consider the following binary search tree diagram:
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:
Q104: Consider the following binary search tree diagram:
Q105: A binary tree of height h can