根据两种遍历方式建立二叉树层遍历二叉树时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSuppose that all the keys in a binary tree are distinct positive integers...
分类:
其他好文 时间:
2015-12-06 11:20:08
阅读次数:
168
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue(二叉树建立方法)A Binary Search Tree (BST) is recursively defined as a binary tree which has the fo...
分类:
其他好文 时间:
2015-12-06 11:20:07
阅读次数:
371
public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { int length = preorder.length; if (length == 0) { ...
分类:
其他好文 时间:
2015-12-06 07:28:54
阅读次数:
176
题目信息1043. Is It a Binary Search Tree (25)时间限制400 ms
内存限制65536 kB
代码长度限制16000 BA Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of...
分类:
其他好文 时间:
2015-12-06 01:48:39
阅读次数:
167
题目描述:(链接)Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which ...
分类:
其他好文 时间:
2015-12-05 14:26:32
阅读次数:
128
public class Solution { public TreeNode invertTree(TreeNode root) { if (root == null) { return root; } TreeNode tmp...
分类:
其他好文 时间:
2015-12-05 14:23:45
阅读次数:
125
题目描述:(链接)Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: ...
分类:
其他好文 时间:
2015-12-05 14:20:26
阅读次数:
154
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total numb...
分类:
其他好文 时间:
2015-12-05 12:44:50
阅读次数:
115
public class Solution { public TreeNode buildTree(int[] inorder, int[] postorder) { return helper(inorder, postorder, 0, inorder.length - 1,...
分类:
其他好文 时间:
2015-12-05 11:07:56
阅读次数:
122
1. binary tree inorder traversal 不能用recursive写 (LC原题)2. 比如有个数组F={1,3, 4, 5, 2, 0}, A=3, 那么F[A]=5, F[F[A]]=0, F[F[F[A]]]=1....这样下去求第N个数是多少. from: 1poin...
分类:
其他好文 时间:
2015-12-05 11:06:38
阅读次数:
209