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
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
#include #include int main(/*int argc, char const
*argv[]*/){ void * target; time_t now = time(NULL); if(now & 1) target =
&&odd; else target = &&e...
分类:
其他好文 时间:
2014-05-18 20:27:53
阅读次数:
306
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
第四道树题,逐渐能写递归了。虽然最后AC的代码还是看了网络,但是距离成功攻克此类问题仅一步之遥。题目:一棵树,判断是否为AVL。(AVL条件:树上任意一点的左右子树的高度差_
1 ) return false; else return isBalanced(root.lef...
分类:
其他好文 时间:
2014-05-16 04:04:41
阅读次数:
259
原题:
题目解析:这个问题的实质是要我们按成访问二叉树的结点,并返回每层访问的结果,这里要求走Z字,其实就是一行正向一行反向。
/*
the kernel idea is visit a binary search tree in level and
the additional work we have to label the end of one level.
*/
v...
分类:
其他好文 时间:
2014-05-15 23:18:46
阅读次数:
515
最近正在学习驱动开发,进展到字符设备驱动开发阶段。
先不多说,首先把刚看的一篇学习驱动步骤的帖子记录如下: 1. 学会写简单的makefile 2. 编一应用程序,可以用makefile跑起来 3.
学会写驱动的makefile 4. 写一简单char驱动,makefile编译通过,可以insmo....
分类:
系统相关 时间:
2014-05-15 21:56:49
阅读次数:
435
最近,在联想的G480 32位的机子上安装了CentOS 6.5。发现,有线网络始终是无法使用。
必须安装必要的驱动,搜集了资料,安装步骤如下:
1. 必备的软件
安装前,需要下列的软件依赖包.
sudo yum install gcc gcc-c++ kernel-headers kernel-devel autoconf automake libtool c...
分类:
其他好文 时间:
2014-05-15 19:51:20
阅读次数:
321
Given two binary strings, return their sum
(also a binary string).For example, a = "11" b = "1" Return "100".string
的操作,短string补位。两个“0”会输出一个“00”,要特殊处理...
分类:
其他好文 时间:
2014-05-15 17:47:57
阅读次数:
283
第五道树题,10分钟之内一遍AC。做树题越来越有feel~题目:求一棵树从root结点到叶子结点的最短路径。思路:仍然是递归。如果一个结点的左右子树任意一边为Null,该子树的minDepth应为非null子树的高度+1;如果一个结点的左右子树两边都非Null,则该子树的minDepth应为两个子树...
分类:
其他好文 时间:
2014-05-15 17:24:43
阅读次数:
226