题目:Binary Tree Level Order Traversal i iii和ii的差别仅在于最后将结果逆序一下就行了,算法上基本相同个人思路:1、二叉树的层次遍历,我们一层一层地处理,用一个队列(A队列)将每一层的所有节点按照从左到右的顺序入队2、待该队列的所有节点都出队,并且用另外一个队...
分类:
其他好文 时间:
2014-06-28 17:01:33
阅读次数:
235
Given a binary tree, return the inorder traversal of its nodes' values.For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3,2]...
分类:
其他好文 时间:
2014-06-28 11:26:55
阅读次数:
206
A lot of computations involve processing a string one character at a time. Often they start at the beginning, select each character in turn, do someth...
分类:
其他好文 时间:
2014-06-23 07:19:02
阅读次数:
257
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3].Not...
分类:
其他好文 时间:
2014-06-21 06:40:07
阅读次数:
172
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3]...
分类:
其他好文 时间:
2014-06-20 19:37:40
阅读次数:
136
从前文《 源码解析:dialog, popupwindow, 和activity 的第一个view是怎么来的?》中知道了activity第一个view或者说根view或者说mDecorView 其实就是一个FrameLayout,以及是在系统handleResume的时候加入到系统windowManager中的,并由framework中的ViewRootImpl
接管,通过ViewRootIm...
分类:
其他好文 时间:
2014-06-17 22:07:59
阅读次数:
277
简单来说,就是二叉树的前序、中序、后序遍历,包括了递归和非递归的方法前序遍历(注释中的为递归版本): 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 struct TreeNode 9 {1...
分类:
其他好文 时间:
2014-06-17 12:53:42
阅读次数:
416
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,#,#,15,7},
...
分类:
其他好文 时间:
2014-06-15 15:17:43
阅读次数:
192
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
/ 9 20
...
分类:
其他好文 时间:
2014-06-15 13:26:54
阅读次数:
200
1、
??
Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return ...
分类:
其他好文 时间:
2014-06-14 14:11:27
阅读次数:
315