Find the extreme nodes of each level of Binary Tree in alternate order.
For example, for the following binary tree,
1
2 3
4 5 6 7
8
Should have output
1->2->7->8
Your Answer.java should implement following interface.
import java.util.List;
public interface ExtremeNodesInterface
{
public List<Integer> PrintExtremeNodesZigZag(Node root);
}
Sample Node.java (No need to upload this)
public class Node {
public int nodeValue;
public Node lChild;
public Node rChild;
}
Answer
Answer
No comments:
Post a Comment