本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41929059
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
...
分类:
其他好文 时间:
2014-12-15 09:04:30
阅读次数:
137
题目 Binary Tree Level Order Traversal II通过率30.6%难度EasyGiven a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from ...
分类:
其他好文 时间:
2014-12-13 23:17:56
阅读次数:
150
实现前序遍历。可参见中序遍历Binary Tree Inorder Traversal递归:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode...
分类:
其他好文 时间:
2014-12-13 23:12:09
阅读次数:
189
实现后序遍历递归:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(...
分类:
其他好文 时间:
2014-12-13 23:07:58
阅读次数:
165
xml结构: 解析方法:$(xml).find("RightMenuItems").each(function () { this.data = Traversal($(this).children());});var Traversal = function (nodes) { v...
分类:
Web程序 时间:
2014-12-12 10:12:15
阅读次数:
106
Given a binary tree, return the postorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3,2,...
分类:
其他好文 时间:
2014-12-12 01:15:30
阅读次数:
244
【题目】
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 alternate between).
For example:
Giv...
分类:
其他好文 时间:
2014-12-09 12:14:27
阅读次数:
164
【题目】
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ ...
分类:
其他好文 时间:
2014-12-08 10:44:51
阅读次数:
161
【题目】
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursi...
分类:
其他好文 时间:
2014-12-07 17:49:21
阅读次数:
135
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
基本思想和知道前序与中序的思想一样,中序的某一节点的左节点一定是该节点的左子树,而后序遍历的某一节点的左节点一定...
分类:
其他好文 时间:
2014-12-05 17:36:45
阅读次数:
116