Multiple Choice
The height of a tree can be obtained by recursively computing the heights of its subtrees, while keeping track of the height of the deepest subtree. Given the Node class discussed in section 17.1 (partially shown below) , select an expression to complete the recursive method height, which is designed to return the height of the tree rooted at a node. class Node
{
Public Object data;
Public List<Node> children;
) . .
Public int height()
{
Int maxChildHeight = 0;
For (Node child : children)
{
Int childHeight = child.height() ;
If (childHeight > maxChildHeight)
MaxChildHeight = childHeight;
}
Return _________________;
}
}
A) maxChildHeight
B) maxChildHeight + 1
C) maxChildHeight + 2
D) maxChildHeight + height()
Correct Answer:

Verified
Correct Answer:
Verified
Q8: If a min-heap has 14 nodes, what
Q9: Consider the following binary search tree: <img
Q10: Consider the following tree diagram: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB7390/.jpg"
Q11: If both of the child references of
Q12: The nodes in our binary search tree
Q14: Consider the following Huffman encoding tree: <img
Q15: If the child references of a binary
Q16: Consider the following tree diagram: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB7390/.jpg"
Q17: A binary tree with 260 nodes has
Q18: Given the BinarySearchTree class discussed in section