LeetCode 105:
Given preorder and inorder traversal of a tree, construct the binary tree.
给定一个二叉树的前序和中序遍历,重建这棵二叉树。
LeetCode 106:
Given inorder and postorder traversal of a tree, constru...
分类:
其他好文 时间:
2015-05-21 09:12:32
阅读次数:
207
Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.解题思路:给出一个二叉树的中...
分类:
其他好文 时间:
2015-05-21 06:40:31
阅读次数:
121
public class Solution { public TreeNode buildTree(int[] inorder, int[] postorder) { if (inorder == null || postorder == null || inorder.leng...
分类:
其他好文 时间:
2015-05-19 10:11:11
阅读次数:
113
https://leetcode.com/problems/binary-tree-postorder-traversal/Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given...
分类:
其他好文 时间:
2015-05-18 12:49:08
阅读次数:
98
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.代码:/** * De...
分类:
其他好文 时间:
2015-05-16 13:12:01
阅读次数:
116
题目描述:
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: Recu...
分类:
其他好文 时间:
2015-05-11 09:10:00
阅读次数:
104
Given inorder and postorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
基本思路:
人中序和后序遍历结果中,构造出二叉树。
中序遍历为: {左子树} 根 {右子树}
后序遍...
分类:
其他好文 时间:
2015-05-08 16:34:15
阅读次数:
135
problem:
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: R...
分类:
其他好文 时间:
2015-05-05 12:45:27
阅读次数:
123
Given a binary tree, return the postorder traversal of its nodes' values....
分类:
其他好文 时间:
2015-05-03 20:42:49
阅读次数:
96
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 a bina...
分类:
其他好文 时间:
2015-05-03 10:40:50
阅读次数:
142