Description
Given this Tree T, answer the following questions:
1 Assuming T is defined in Java, what code do I write to get “sun” back?
2 What will System.out.println(T.getChildren().get(2).getChildren()) output? Be as specific as possible.
3 Given the following code, what will we output for mystery(T)?
public static void mystery(TreeNode<String> node) {
List<TreeNode<String>> children = node.getChildren(); for (int i = 1; i < children.size(); i++) {
TreeNode<String> child = children.get(i); System.out.println(child.getValue()); mystery(child);
}
}
Reviews
There are no reviews yet.