题目: Given preorder and inorder traversal of a tree, construct the binary tree. 思路: 线序序列的第一个元素就是树根,然后在中序序列中找到这个元素(由于题目保证没有相同的元素,因此可以唯一找到),中序序列中这个元素的左边就
分类:
其他好文 时间:
2016-02-05 11:44:41
阅读次数:
110
? package cn.edu.xidian.sselab.hashtable;import java.util.ArrayList;import java.util.List;import java.util.Stack;/** * * @author zhiyong wang * title:
分类:
其他好文 时间:
2016-01-31 02:38:19
阅读次数:
179
Using DFS to traverse the node and build the a tree. for a node, it has following properties: If its a left child node of its parent, then the left bo
分类:
其他好文 时间:
2016-01-29 08:42:46
阅读次数:
168
二叉树的中序遍历,即左子树,根, 右子树 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right;...
分类:
其他好文 时间:
2016-01-24 22:12:43
阅读次数:
123
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.提示:题目要求通过一颗...
分类:
其他好文 时间:
2016-01-24 15:39:31
阅读次数:
265
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.思路:递归,preord...
分类:
其他好文 时间:
2016-01-10 11:44:45
阅读次数:
156
Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
分类:
其他好文 时间:
2016-01-06 17:36:56
阅读次数:
117
Given a binary search tree and a node in it, find the in-order successor of that node in the BST.Note: If the given node has no in-order successor in ...
分类:
其他好文 时间:
2016-01-06 06:45:16
阅读次数:
161
题目:Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3...
分类:
其他好文 时间:
2016-01-05 15:17:13
阅读次数:
125