http://blog.csdn.net/zhangxiangdavaid/article/details/37115355
http://blog.csdn.net/jssongwei/article/details/50790253
二叉樹的層次遍歷:java實(shí)現(xiàn)
privatestaticvoidlevelTraversal(Nodenode){
Queuequeue=newLinkedList<>();
if(node==null){
return;
}
queue.add(node);
while(queue.size()>0){
node=queue.poll();
printNode(node);
if(node.getLeftNode()!=null){
queue.add(node.getLeftNode());
}
if(node.getRightNode()!=null){
queue.add(node.getRightNode());
}
}
}