#include "iostream"
#include "cstdio"
using namespace std;
struct Node{
int val;
Node *left, *right;
Node(int v = 0){
val = v;
left = NULL;
right = NULL;
}
};
inline void preOrder(Node *he...
分类:
其他好文 时间:
2015-01-13 21:44:22
阅读次数:
184
The problem:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3retur...
分类:
其他好文 时间:
2015-01-11 10:54:00
阅读次数:
156
The problem:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3retur...
分类:
其他好文 时间:
2015-01-11 10:53:49
阅读次数:
143
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-09 18:46:57
阅读次数:
151
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
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
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
题目描述:
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
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