这两道题用递归的解法都很简单,只是稍有不同。下面是AC代码: 1 /** 2 * Given a
binary tree, find its minimum depth. 3 * the minimum depth is the number of
nodes along th...
分类:
其他好文 时间:
2014-05-10 08:47:32
阅读次数:
271
不断递归的实现!!!!下面是AC代码: 1 /** 2 * Given inorder and
postorder traversal of a tree, construct the binary tree. 3 * @param inorder 4 *
@param...
分类:
其他好文 时间:
2014-05-10 08:40:40
阅读次数:
297
这道题因为不仔细的缘故两次过,与Maximum Depth of Binary
Tree问题类似,区别在于这个问题中,如果一个节点左子树为空、右子树有值,则该节点的深度应取决于右子树,而不能直接取min{左,右} 1 /** 2 *
Definition for binary tree 3 * .....
分类:
其他好文 时间:
2014-05-10 01:40:13
阅读次数:
293
1,安装arm-linux-gcc安装方法,将安装包解压到/opt下,然后vim
/.bashrc修改一行:export PATH =
$PATH:/opt/FriendlyARM/tooschain/4.5.1/bin,后面是安装的路径,重新登录系统,注销即可,然后arm-linux-+Tab键就...
分类:
系统相关 时间:
2014-05-10 01:33:20
阅读次数:
512
明天就回国了,今晚回国前写写如何配置eclipse和CDT。这个配置方法网上讨论不是很多,可能用的人少,毕竟Windows上写C++程序多数喜欢VS,即使写的是Linux程序,很多人仍然会用VS(说只喜欢用VI的人我佩服)。的确VS很强大,但我也geek一回,使用eclipse做C++程序(用VI才...
分类:
数据库 时间:
2014-05-10 01:29:27
阅读次数:
396
A heap is a partially sorted binary tree.
Although a heap is not completely in order, it conforms to a sorting principle:
every node has a value less ...
分类:
其他好文 时间:
2014-05-09 17:34:18
阅读次数:
339
一、Nginx安装:采取手动编译安装对多种重要的选项进行配置安装前提:常用工具和库,GCC
PCRE(Rewrite模块需要) pcre-devel(源码) zlib zlib-devel(源码) OpenSSL
openssl-devel(源码)配置选项./configure --help列出有效...
分类:
其他好文 时间:
2014-05-09 17:02:14
阅读次数:
488
原因:因为工作需要,集中管理log4j日志到MongoDB!进入MongoDB下载中心:http://www.mongodb.org/downloadsWe
recommend using these binary distributions (官方推荐使用二进制版本!)根据自己的实际系统环境,下载...
分类:
数据库 时间:
2014-05-09 16:35:35
阅读次数:
393
BFS以及它的扩展,我发现栈是个很好用的数据结构,特别是对于顺序需要颠倒的时候!!!这里有个重要的信息:可以用null来标识一个level的结束!!!下面是AC代码:
1 /** 2 * Given a binary tree, return the bottom-up level ord...
分类:
其他好文 时间:
2014-05-05 09:46:06
阅读次数:
402
Array和List的区别在于前者可以随机访问,而后者只能顺序访问。对于把排好序的array转成BST,可以用top-down的方式,很直观也很自然,时间复杂度是O(n)。而对于List如果采用同样的方式,每次需要顺序遍历到中间节点,时间复杂度变成O(nlogn),如果换一种思路,down-top,...
分类:
其他好文 时间:
2014-05-05 09:34:29
阅读次数:
454