题目:
zigzag,就是锯齿状的数字顺序,其形式就是首尾行间断的比内部行少一个,就是下面的形式。
1 * 7
2 6 8 12
3 5 9 11
4 * 10
更好看点就是
1 7
2 ...
分类:
其他好文 时间:
2014-05-19 22:43:12
阅读次数:
373
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 the depth...
分类:
其他好文 时间:
2014-05-19 20:40:55
阅读次数:
278
题目链接:HDU 2795 Billboard【题意】给你一张h*w(1 7 #include
8 #include 9 using namespace std;10 const int MAX = 200005;11 12 int tree[MAX=
val)26 {27 ...
分类:
其他好文 时间:
2014-05-19 10:09:17
阅读次数:
419
Given a binary tree, determine if it is a valid
binary search tree (BST).Assume a BST is defined as follows:The left subtree of
a node contains only n...
分类:
其他好文 时间:
2014-05-19 07:23:48
阅读次数:
357
伸展树概念 伸展树(Splay Tree)是一种二叉排序树,它能在O(log
n)内完成插入、查找和删除操作。它由Daniel Sleator和Robert Tarjan创造。 (01)
伸展树属于二叉查找树,即它具有和二叉查找树一样的性质:假设x为树中的任意一个结点,x节点包含关键字key,节点x...
分类:
其他好文 时间:
2014-05-18 19:17:30
阅读次数:
225
求树的最大路径和(Binary Tree Maximum Path Sum)...
分类:
其他好文 时间:
2014-05-18 18:25:41
阅读次数:
235
对于本题,想到一个中序遍历后,判别是否为回文串的方法,却WA多次
class Solution {
public:
vector vectorValue;
void inOrder(TreeNode* root)
{
if(root!=NULL)
{
inOrder(root->left);...
分类:
其他好文 时间:
2014-05-18 06:38:58
阅读次数:
294
1、
??
Path Sum
Given 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 given sum.
For example:
Given the below...
分类:
其他好文 时间:
2014-05-18 03:25:06
阅读次数:
301
红黑树概念
特殊的二叉查找树,每个节点上都有存储位表示节点的颜色是红(Red)或黑(Black)。时间复杂度是O(lgn),效率高。 特性:
(1)每个节点或者是黑色,或者是红色。 (2)根节点是黑色。 (3)每个叶子节点(NIL)是黑色。(只为空(NIL或null)的节点)
(4)如果一个节点是红...
分类:
其他好文 时间:
2014-05-18 01:38:25
阅读次数:
611
Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space is ...
分类:
其他好文 时间:
2014-05-17 14:45:17
阅读次数:
290