Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
/**
* Definition for binary tree
* struct TreeNode {...
分类:
其他好文 时间:
2014-08-01 19:53:32
阅读次数:
222
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解:这道题跟pre....
分类:
编程语言 时间:
2014-08-01 06:56:51
阅读次数:
185
Construct Binary Tree from Inorder and Postorder TraversalGiven inorder and postorder traversal of a tree, construct the binary tree.Note:You may assu...
分类:
其他好文 时间:
2014-07-31 23:26:00
阅读次数:
286
二叉树的后序遍历递归实现/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : v...
分类:
其他好文 时间:
2014-07-31 12:30:16
阅读次数:
224
题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3...
分类:
编程语言 时间:
2014-07-30 11:33:23
阅读次数:
258
Another textbook problem. We take back of postorder array as the current root, and then we can split the inorder array: 1st half for current right chi...
分类:
其他好文 时间:
2014-07-23 12:01:56
阅读次数:
210
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-07-19 19:00:44
阅读次数:
262
class Solution {public: TreeNode *buildTree(vector &inorder, vector &postorder) { int ilen = inorder.size(); int plen = postorder.siz...
分类:
其他好文 时间:
2014-07-16 18:23:21
阅读次数:
155
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: Recursive solut...
分类:
其他好文 时间:
2014-07-13 17:18:19
阅读次数:
193
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.说明: 1)实现与.....
分类:
其他好文 时间:
2014-07-11 20:40:38
阅读次数:
198