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-09 15:29:53
阅读次数:
115
https://oj.leetcode.com/problems/binary-tree-preorder-traversal/http://blog.csdn.net/linhuanmars/article/details/21428647/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolu..
分类:
其他好文 时间:
2015-01-09 01:52:30
阅读次数:
274
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].No...
分类:
其他好文 时间:
2015-01-08 15:14:07
阅读次数:
208
The problem:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My...
分类:
其他好文 时间:
2015-01-08 13:15:07
阅读次数:
109
The problem:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.My ...
分类:
其他好文 时间:
2015-01-08 12:54:39
阅读次数:
97
原题如下;
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
题意很简单:根据中序遍历和后序遍历的序列生成树
思路很简单:根据后序遍历的序列确定根节点,在中序遍历中找到根节点,将原来的序列分为左右两个部分,递归解决左右两个部分就可以解决这个问题。
Java代码如下:
publ...
分类:
其他好文 时间:
2015-01-07 01:52:25
阅读次数:
160
https://oj.leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/http://blog.csdn.net/linhuanmars/article/details/24389549/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){va..
分类:
其他好文 时间:
2015-01-06 15:55:10
阅读次数:
101
https://oj.leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/http://blog.csdn.net/linhuanmars/article/details/24390157/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){v..
分类:
其他好文 时间:
2015-01-06 15:54:59
阅读次数:
138
https://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/http://blog.csdn.net/linhuanmars/article/details/23414711/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publiccla..
分类:
其他好文 时间:
2015-01-06 15:49:37
阅读次数:
96
https://oj.leetcode.com/problems/binary-tree-level-order-traversal/http://blog.csdn.net/linhuanmars/article/details/23404111/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassS..
分类:
其他好文 时间:
2015-01-06 12:09:39
阅读次数:
175