How do I iterate over Binary Tree?

Posted by kunjaan on Stack Overflow See other posts from Stack Overflow or by kunjaan
Published on 2010-05-31T09:13:40Z Indexed on 2010/05/31 9:22 UTC
Read the original article Hit count: 186

Filed under:
|
|

Right now I have

 private static void iterateall(BinaryTree foo) {
    if(foo!= null){
    System.out.println(foo.node);
    iterateall(foo.left);
    iterateall(foo.right);
   }
  }

Can you change it to Iteration instead of a recursion?

© Stack Overflow or respective owner

Related posts about java

Related posts about recursion