Path Sum IGiven 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 gi...
分类:
其他好文 时间:
2014-05-09 13:21:59
阅读次数:
320
If you ever had the problem where you need to
extract files from a SharePoint Content Database or normal SQL Database stored
as binary, this post will...
分类:
数据库 时间:
2014-05-09 09:54:59
阅读次数:
495
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-05-09 09:28:18
阅读次数:
253
http://acm.hdu.edu.cn/showproblem.php?pid=1325
1 #include 2 #include 3 #include 4 #define maxn 5000 5 using namespace std; 6 7
int in[maxn]...
分类:
其他好文 时间:
2014-05-09 08:42:25
阅读次数:
316
这道题就是找规律啊!!!想想啊,11和10是可以连续的,那么10和11也是可以连续的。下面是AC代码:
1 /** 2 * The gray code is a binary numeral system where two successive values
differ in on...
分类:
其他好文 时间:
2014-05-09 07:38:17
阅读次数:
325
$per_len=20000;//每次读多少字节$no_read_len=$content_len;//未读的字节(总字节大小)$str=‘‘;while($len<$content_len){$read=socket_read($socket,$per_len,PHP_BINARY_READ);$str.=$read;$len+=strlen($read);//总共读了多少字节}http://hi.baidu.com/cuttinger/item/..
分类:
Web程序 时间:
2014-05-09 06:45:59
阅读次数:
566
最近在看这本书。不过发现需要安装编译工具 lex, yacc。书上说Linux自带lex, yacc。不过我发现我的没有。并且,ubuntu不使用lex, yacc。输入sudo apt-get install yacc lex
会报错, 报错内容如下:Reading package lists... Done
Building dependency tree
Reading sta...
分类:
其他好文 时间:
2014-05-09 06:18:48
阅读次数:
989
必须承认,一开始这道题我是不会做的,因为我心目中的树遍历只能用一个节点发起,多么天真而无知。
我想不通怎样同时遍历两颗子树,因为根节点一定是一个啊。可是,作为对称轴上的它,从一开始就不应该被考虑,他的左右孩子,不是很自然的形成了两个遍历的入口吗?可见无知是多么的可怕。
bool helper(TreeNode *left, TreeNode *right){
if(left == NU...
分类:
其他好文 时间:
2014-05-09 02:18:26
阅读次数:
223
这是一道好题,思路虽然有,但是提交之后总是有数据过不了,又按照数据改改改,最后代码都没法看了。收到的教训是如果必须为自己的代码加上很多很多特殊的限定,来过一些特殊的数据的话,说明代码本身有很大的漏洞。
这道题,我想到了要用两个指针保存乱序的节点,甚至想到了用一个pre指针来保存前面一个节点,但是问题出在哪里呢?我觉得应该是自己对树的遍历理解的不够深刻。既然知道了二叉搜索树一定是用中序遍历的,那么...
分类:
其他好文 时间:
2014-05-09 01:54:42
阅读次数:
250
这道题是为数不多的感觉在读本科的时候见过的问题。人工构造的过程是怎样呢,后续遍历最后一个节点一定是整棵树的根节点,从中序遍历中查找到这个元素,就可以把树分为两颗子树,这个元素左侧的递归构造左子树,右侧的递归构造右子树,元素本身分配空间,作为根节点。
于set和map容器不同的是,vector容器不含find的成员函数,应该用stl的库函数,好在返回的也是迭代器,而vector的迭代器之间是可以做...
分类:
其他好文 时间:
2014-05-09 01:23:38
阅读次数:
275