https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/24509105/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publi..
分类:
其他好文 时间:
2015-01-06 12:07:28
阅读次数:
147
题目描述:
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
解题思路:先序遍历的第一个元素为根元素,在中序遍历序列中找到根元素的位置。中...
分类:
其他好文 时间:
2015-01-06 11:58:44
阅读次数:
159
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree./** * Defini...
分类:
其他好文 时间:
2015-01-06 07:09:29
阅读次数:
207
https://oj.leetcode.com/problems/binary-tree-inorder-traversal/http://blog.csdn.net/linhuanmars/article/details/20187257/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolut..
分类:
其他好文 时间:
2015-01-05 18:57:54
阅读次数:
133
每日一练,Givenabinarytree,returnthelevelordertraversalofitsnodes‘values.(ie,fromlefttoright,levelbylevel).Forexample:Givenbinarytree{3,9,20,#,#,15,7},3
/920
/157returnitslevelordertraversalas:[
[3],
[9,20],
[15,7]
]代码如下:classSolution{
public:
in..
分类:
其他好文 时间:
2015-01-05 07:06:51
阅读次数:
165
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:
其他好文 时间:
2015-01-03 17:18:44
阅读次数:
136
Construct Binary Tree from Preorder and Inorder TraversalGiven preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume...
分类:
其他好文 时间:
2015-01-03 00:53:53
阅读次数:
235
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
class Solution {
private:
TreeNode *root;
v...
分类:
其他好文 时间:
2015-01-02 09:46:36
阅读次数:
107
https://oj.leetcode.com/problems/binary-tree-postorder-traversal/http://blog.csdn.net/ljphhj/article/details/21369053/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution..
分类:
其他好文 时间:
2015-01-02 07:33:36
阅读次数:
132
题目:(Tree ,Stack)Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3...
分类:
其他好文 时间:
2015-01-01 07:54:28
阅读次数:
116