/**
* 二叉树遍历
*/
public class BinaryTree {

/**
* 先序遍历
* @param head 根节点
*/
public void preOrder(Node head) {
if (head == null) {
return;
}
System.out.println(head.value);
preOrder(head.left);
preOrder(head.right);
}

/**
* 中序遍历
* @param head 根节点
*/
public void midOrder(Node head) {
if (head == null) {
return;
}
midOrder(head.left);
System.out.println(head.value);
midOrder(head.right);
}

/**
* 后序遍历
* @param head 根节点
*/
public void postOrder(Node head) {
if (head == null) {
return;
}
postOrder(head.left);
postOrder(head.right);
System.out.println(head.value);
}

/**
* 非递归方法实现 先序、中序、后序 遍历二叉树
*/
// TODO

/**
* 二叉树结构
*/
public class Node {
public int value;

public Node left;

public Node right;

public Node(int value) {
this.value = value;
}
}

}

/* 如有意见或建议,欢迎评论区留言;如发现代码有误,欢迎批评指正 */