原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/题意:二叉树的层序遍历的实现。解题思路:二叉树的层序遍历可以用bfs或者dfs来实现。这里使用的dfs实现,代码比较简洁。实际上,二叉树的先序遍历就是dfs实...
分类:
编程语言 时间:
2014-05-14 03:25:59
阅读次数:
428
原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/题意:Given
a binary tree, return thebottom-up level ordertraversal of its node...
分类:
编程语言 时间:
2014-05-12 22:03:27
阅读次数:
581
原题地址:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/题意:Given
a binary tree, return thezigzag level ordertraversal of its nod...
分类:
编程语言 时间:
2014-05-12 22:02:26
阅读次数:
480
原题地址:http://oj.leetcode.com/problems/minimum-depth-of-binary-tree/题意:Given
a binary tree, find its minimum depth.The minimum depth is the number of no...
分类:
编程语言 时间:
2014-05-12 21:55:15
阅读次数:
348
原题地址:http://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/题意:将一个排序好的数组转换为一颗二叉查找树,这颗二叉查找树要求是平衡的。解题思路:由于要求二叉查找树是平衡的。所以我们可以选在数组的中间那...
分类:
编程语言 时间:
2014-05-12 21:44:57
阅读次数:
379
Xfce是linux系统下的一个桌面环境,安装方法如下:利用系统自带的yum源,找不到xfce,更新yum源,#wgethttp://mirrors.ustc.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpm#rpm-ivhepel-release-6-8.noarch.rpm#yumsearchxfce4#yumgroupinfoXfce#yumgroupinstallXfce#..
分类:
其他好文 时间:
2014-05-12 03:46:55
阅读次数:
348
原题地址:http://oj.leetcode.com/problems/sum-root-to-leaf-numbers/题意:Given
a binary tree containing digits from0-9only, each root-to-leaf path could
repre...
分类:
编程语言 时间:
2014-05-12 01:28:30
阅读次数:
440
一直没有点动态树这个科技树,因为听说只能用Splay,用Treap的话多一个log。有一天脑洞大开,想到也许Treap也能从底向上Split。仔细思考了一下,发现翻转标记不好写,再仔细思考了一下,发现还是可以写的,只需要实时交换答案二元组里的两棵树,最后在吧提出来的访问节点放回去就行了。本着只学.....
分类:
其他好文 时间:
2014-05-11 22:56:42
阅读次数:
605
在考虑自动化测试用例时,不仅仅要考虑测试的执行步骤。在运行任何步骤之前,程序必须处在能够执行测试的状态。在测试执行后,至关重要的是知道测试是否通过,并且测试结果一定要被保存到某处以待检查或进一步分析。另外,还可能需要清理测试中生成的垃圾(文件、注册表设置等)。最后,测试一定要易于维护和易于理解,以便...
分类:
其他好文 时间:
2014-05-11 22:55:39
阅读次数:
345
题目链接:点击打开链接
题意比较明显,不赘述。
删除时可以把i-1转到根,把i+1转到根下
则i点就在 根右子树 的左子树,且只有i这一个 点
#include
#include
#include
#include
using namespace std;
#define N 300500
#define inf 10000000
#define L(x) tree[x].ch[0]
#d...
分类:
其他好文 时间:
2014-05-11 21:05:52
阅读次数:
365