/***@authorcj 2017年7月14日下午1:14:31*/
packagecom.yuanye.algorithm;importjava.util.LinkedList;importjava.util.List;public classBinaryTree {//private static List currentLevelNodes=new ArrayList<>();//private static List nextLevelNodes=new ArrayList<>();
private static List nodeList=new LinkedList<>();public static voidmain(String[] args) {
Node rootNode=newNode();
rootNode.setValue(88);
generateTree(rootNode,5,0);
printTree(rootNode);
}public static void generateTree(Node parentNode,int depth,intcurrentDepth){if(currentDepth>depth-1)return;
Node leftNode=newNode();
leftNode.setValue(6000+currentDepth);
Node rightNode=newNode();
rightNode.setValue(9000+currentDepth);
parentNode.setLeftNode(leftNode);
parentNode.setRightNode(rightNode);
generateTree(leftNode,depth,curre