Find all the extreme nodes of a binary tree in a zigzag order

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

No comments:

Post a Comment