{
if(node.getLeftNode()!=null)
{
this.zhongIterator(node.getLeftNode());
}
this.printNode(node);
if(node.getRightNode()!=null)
{
this.zhongIterator(node.getRightNode());
}
}
/**后序遍历二叉树*/
public void houIterator(TreeNode
{
if(node.getLeftNode()!=null)
{
this.houIterator(node.getLeftNode());
}
{
this.houIterator(node.getRightNode());
}
this.printNode(node);
}
public static void main(String[] args) {
BinaryTree binaryTree = new BinaryTree();
TreeNode
System.out.println("先序遍历的情况");
binaryTree.xianIterator(node);
System.out.println("\n中序遍历的情况");
binaryTree.zhongIterator(node);
System.out.println("\n后序遍历的情况");
binaryTree.houIterator(node);
}
}