1
Answer

iterator on a Tree

Marco

Marco

17y
1.9k
1
class Node {
   private int value;
   public Node (int i) {value=i;}
   Node Left;
   Node Right;
   Node Parent;
}

class BinaryTree {
   private Node root;
   public Tree { root = new Node());
   //other
}

Assuming the two class are wrote right; I'm looking a way two write an Iterator on the tree (ie an iterator that go down on the nodes of the Tree). Is there a way? How to write it?
thank you.
Answers (1)