Esempio n. 1
0
 private void populatePostOrder(TreeNode<T> currentNode, final LinkedList<TreeNode<T>> stack) {
   List<TreeNode<T>> children = currentNode.getChildren();
   for (TreeNode<T> childNode : children) {
     populatePostOrder(childNode, stack);
   }
   stack.addLast(currentNode);
 }
Esempio n. 2
0
 public Iterator<TreeNode<T>> getPostOrderIter() {
   final LinkedList<TreeNode<T>> stack = new LinkedList<TreeNode<T>>();
   populatePostOrder(this, stack);
   return stack.iterator();
 }