Nearest Common AncestorsTime Limit:1000MSMemory Limit:10000KTotal Submissions:17720Accepted:9393DescriptionA rooted tree is a well-known data structur...
分类:
其他好文 时间:
2014-07-31 02:43:35
阅读次数:
327
题目: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 farthes....
分类:
编程语言 时间:
2014-07-31 02:41:15
阅读次数:
229
题目:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the neares....
分类:
编程语言 时间:
2014-07-31 02:30:25
阅读次数:
264
题目:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 /...
分类:
编程语言 时间:
2014-07-31 02:28:25
阅读次数:
376
题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identica....
分类:
编程语言 时间:
2014-07-31 02:24:15
阅读次数:
211
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example: Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-07-30 20:33:34
阅读次数:
193
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 pretty straight...
分类:
其他好文 时间:
2014-07-30 17:46:04
阅读次数:
244
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center)....
分类:
其他好文 时间:
2014-07-30 14:48:53
阅读次数:
216
Dtree目录树的总结 ????????????????? 一:函数 ?????????????????????????? 1:页面中 ????????????????????????????? tree.a...
分类:
Web程序 时间:
2014-07-30 12:38:34
阅读次数:
405
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1325
这题与HDU1272 小希的迷宫 (并查集) 非常像,不过细细看,还是有一点区别的。
就是这题的路径是单向的,每次只能由起点指向终点,在连接之前终点必须是根节点。
注意的问题:
1、不能成环,即每次输入的两个数的根节点不能相同;
2、最终根节点数目为一
3、注意当只输入“0 0” 时要输出”Case %d is a tree.“
4、路径是单向的,即每次只能由起点指向终点,在连接之前终点必须是根节点。...
分类:
其他好文 时间:
2014-07-30 12:20:33
阅读次数:
221