Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-10-26 06:48:34
阅读次数:
188
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2014-10-26 06:47:17
阅读次数:
187
参考:http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion-and-without-stack/
1. Initialize current as root
2. While current is not NULL
If current does not have left child
a)...
分类:
其他好文 时间:
2014-10-22 14:38:08
阅读次数:
187
给定一个二叉树,以集合方式返回其中序/先序方式遍历的所有元素。有两种方法,一种是经典的中序/先序方式的经典递归方式,另一种可以结合栈来实现非递归Given a binary tree, return theinordertraversal of its nodes' values.For examp...
分类:
其他好文 时间:
2014-10-21 22:49:08
阅读次数:
269
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2014-10-21 21:02:56
阅读次数:
259
Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa...
分类:
其他好文 时间:
2014-10-20 23:17:30
阅读次数:
261
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-10-19 22:42:10
阅读次数:
223
【题目】
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#...
分类:
其他好文 时间:
2014-10-16 18:00:42
阅读次数:
245
【题目】
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recu...
分类:
其他好文 时间:
2014-10-15 23:57:11
阅读次数:
229
题目:Binary Tree Preorder Traversal二叉树的前序遍历,同样使用栈来解,代码如下: 1 struct TreeNode { 2 int val; 3 TreeNode* left; 4 TreeNode* righ...
分类:
其他好文 时间:
2014-10-11 22:44:56
阅读次数:
222