标签:void lin highlight pre har new 层序遍历 private evel
private void LevelOrder(TreeNode node) { Queue<TreeNode> queue = new Queue<TreeNode>(); queue.Enqueue(node); TreeNode treeNode = null; while(queue.Count>0) { treeNode = queue.Dequeue(); if(treeNode.LeftChild!=null) queue.Enqueue(treeNode.LeftChild); if(treeNode.RightChild!=null) queue.Enqueue(treeNode.RightChild); Console.WriteLine(treeNode.data); } }
标签:void lin highlight pre har new 层序遍历 private evel
原文地址:http://www.cnblogs.com/binglangwu/p/6700766.html