Given a binary tree struct TreeLinkNode {
TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next
pointe...
分类:
其他好文 时间:
2014-07-22 23:16:35
阅读次数:
373
今天继续攒人品。。。真开心啊O(∩_∩)O~~各种身体不舒服~~https://icpcarchive.ecs.baylor.edu/external/65/6577.pdf题意是这样的,现在有一个向下无限延伸的二叉树。然后输入起点(通过只含LRU的字符串S,从根结点开始执行)。LRU分别表示往左儿...
分类:
其他好文 时间:
2014-07-22 23:15:54
阅读次数:
550
其实就是并查集,写麻烦了,同样的代码第一次提交wa了,第二次就过了。 1 #include 2
#include 3 4 #define MAXNUM 55 5 #define UP 0 6 #define RIGHT 1 7 #define DOWN 2
8 #def...
分类:
其他好文 时间:
2014-07-22 23:13:53
阅读次数:
310
/** * Definition for binary tree * struct
TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) :
val(x), left(...
分类:
其他好文 时间:
2014-07-22 23:07:34
阅读次数:
312
Given a binary tree, find its maximum depth.The
maximum depth is the number of nodes along the longest path from the root node
down to the farthest le...
分类:
其他好文 时间:
2014-07-22 23:07:13
阅读次数:
379
Definition: see
wikihttp://en.wikipedia.org/wiki/Binary_search_tree 1 /* 2 This look up is a
fast operation because you eliminate the half 3 t...
分类:
其他好文 时间:
2014-07-22 23:06:34
阅读次数:
330
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-01 14:38:39
阅读次数:
454
并查集的路径压缩。 1 #include 2 #include 3 4 #define MAXNUM
100005 5 6 int deg[MAXNUM], bin[MAXNUM]; 7 char isCycle[MAXNUM]; 8 9 int
find(int x) {10 i...
分类:
其他好文 时间:
2014-04-29 17:22:46
阅读次数:
308
并查集删除结点,方法是构建虚拟点,做映射。 1 #include 2 #include 3 4
#define MAXNUM 1000050 5 6 int bin[MAXNUM], assist[MAXNUM]; 7 char
visit[MAXNUM]; 8 int n, ext; 9 ...
分类:
其他好文 时间:
2014-04-29 17:12:47
阅读次数:
385
Number SequenceTime Limit: 10000/5000 MS
(Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s):
9899Accepted Submission(s): 4518Pr...
分类:
其他好文 时间:
2014-04-29 11:28:46
阅读次数:
354