Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre...
分类:
其他好文 时间:
2014-11-29 17:33:54
阅读次数:
169
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.参考:http://xpentium.blog.163.com/b...
分类:
其他好文 时间:
2014-11-29 17:32:47
阅读次数:
168
这道题也不是非常的难,弄楚平衡二叉树(AVL)的判断方法就行:1.判断左子树高度与右子树高度之差是否小于12.判断根节点左子树是否满足平衡二叉3.判断根节点右子树是否满足平衡二叉满足以上三个条件才是AVL树 1 /** 2 * Definition for binary tree 3 * str.....
分类:
其他好文 时间:
2014-11-29 17:31:39
阅读次数:
199
Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tr...
分类:
其他好文 时间:
2014-11-29 17:29:14
阅读次数:
184
是这题的变种对一棵树从最后一次开始层次遍历,并返回结果。例如:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its bottom-up level order traversal as:[ ...
分类:
其他好文 时间:
2014-11-29 15:57:28
阅读次数:
251
Path SumGiven a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the give...
分类:
其他好文 时间:
2014-11-29 15:49:23
阅读次数:
135
编程小记,已供重温!!Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; ...
分类:
其他好文 时间:
2014-11-29 15:47:58
阅读次数:
106
题目链接:点击打开链接
题意:
卡特兰数前n项和 结果%m
把答案当成2部分搞。
#include
#include
#define int __int64
const int N = 100000;
struct inverse_element{
int x, y, q;
void extend_Eulid(int a,int b)
{
if(...
分类:
其他好文 时间:
2014-11-29 14:37:37
阅读次数:
170
代码实现:给定一个中序遍历和前序遍历怎么构造出这颗树!(假定数中没有重复的数字)因为没有规定是左小右大的树,所以我们随意画一颗数,来进行判断应该是满足题意的。 3 / \ 2 4 /\ / \1 6 5 7中序遍历:1263547.后序遍历:16257...
分类:
其他好文 时间:
2014-11-29 14:27:53
阅读次数:
111
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-11-29 13:03:14
阅读次数:
180