Find all the boundary nodes in a given binary tree. The boundary traversal should start from root, then go clockwise (root->right->left)
For example
1
2 3
4 4 6 7
8 9 1 1 2 3 3 4
This should return: 1->3->7->4->3->3->2->1->1->9->8->4->2
Your Answer.java should implement the following interface
import java.util.List;
public interface BoundaryTraverseTree
{
public List<Integer> BoundaryTraverse(Node root);
}
Here is the sample Node.java (No need to upload this file)
public class Node {
public int nodeValue;
public Node lChild;
public Node rChild;
}
Answer
Answer
No comments:
Post a Comment