Populating Next Right Pointers in Each
NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode
*right; TreeLi...
分类:
其他好文 时间:
2014-05-10 00:32:56
阅读次数:
326
import osdef tree(top): for path, names, fnames in
os.walk(top): for fname in fnames: yield os.path.join(path, fname) for name
in...
分类:
编程语言 时间:
2014-05-09 23:49:35
阅读次数:
367
前序和中序构建二叉树后序和中序构建二叉树分析:主要思路就是
在中序中找根节点然后划分左右子树,具体如下:1. 查找根节点。 我们知道前序序列的第一个元素 和 后序序列的最后一个元素 肯定是根节点,我们就以此为突破口2.
确定根节点的坐标。 我们在 中序序列中找到 根节点 的下标。3. 分割左右子树。...
分类:
其他好文 时间:
2014-05-09 23:17:30
阅读次数:
458
递归实现当然太简单,也用不着为了ac走这种捷径吧。。非递归实现还挺有意思的。
树的非递归遍历一定要借助栈,相当于把原来编译器做的事情显式的写出来。对于中序遍历,先要访问最左下的节点,一定是进入循环后,不断的往左下走,走到不能走为止,这时候,可以从栈中弹出访问的节点,相当于“左根右”过程的“根”,然后应该怎么做呢?想一下中序遍历完根节点之后应该干嘛,对,是走到右子树中继续重复这个过程,但是有一点,...
分类:
其他好文 时间:
2014-05-09 14:57:08
阅读次数:
211
从公司断断续续下载了3天,终于把CM-11.0的代码给下载下来了,分享一下下载编译rom包的过程。一前置条件1ubuntu13.04系统,同时配置好android的编译环境配置方法详见http://source.android.com/source/initializing.html网页2下载源码特别注意:由于cm-11.0的代码巨大,下载完..
分类:
移动开发 时间:
2014-05-09 14:19:13
阅读次数:
443
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
我们可以知道每行最多可以有多少个格子不用建点,设为x[i],每列同理设为y[i],那么我们连接(source,i,x[i]),(i,sink,y[i])表示我们将一个格子不建点,那么(i,j,flag[i][j]),当i,j这个格子可以建点的时候连边表示我们不在这个格子建点,那么n*m-k-最大.....
分类:
其他好文 时间:
2014-05-09 09:13:42
阅读次数:
249
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
最近在看这本书。不过发现需要安装编译工具 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
Free and Open Source softwareNameLicenseBrief
infoADMBBSDnonlinear optimization framework, usingautomatic
differentiationALGENCANGPLFortran code for g...
分类:
其他好文 时间:
2014-05-09 05:52:35
阅读次数:
757