Answer the question
In order to leave comments, you need to log in
How to implement a reverse iterator (PostOrder) to traverse a binary tree in Java?
Tell me how to implement a reverse iterator (PostOrder) to traverse a binary tree in Java, without using stack and other collections.
There is a class:
class Node{
Node left;
Node right;
Node parent;
int val;
}
interface CIterator{
bool hasNext();
int next();
}
class PostOrderIterator implements CIterator{
Node n;
public PostOrderIterator(Node k){
n = k;
}
}
Answer the question
In order to leave comments, you need to log in
What type of tree traversal do you generally use?
And why create your own interfaces when there is a ListIterator?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question