标签:ar java on 数据 ad ef as tt size
package tree.binarytree; import java.util.LinkedList; /** * 层序遍历二叉树 * * @author wl * */ public class PrintFromTopToBotton { public static void printfromtoptobotton(BiTreeNode root) { if (root == null) { return; } LinkedList<BiTreeNode> queue = new LinkedList<BiTreeNode>(); queue.addLast(root); while (queue.size() != 0) { BiTreeNode current = queue.pollFirst(); System.out.println(current.data); if (current.leftNode != null) { queue.addLast(current.leftNode); } if (current.rightNode != null) { queue.addLast(current.rightNode); } } } }
标签:ar java on 数据 ad ef as tt size
原文地址:http://blog.csdn.net/tmwl0728/article/details/41759067