问题:给一个二叉树,写一个算法判断这个树是不是balanced。Solution
#1.第一次遇到这个问题时我的解法,如下:public class Solution { public boolean isBalanced(TreeNode
root) { if(root == ...
分类:
其他好文 时间:
2014-05-05 12:50:49
阅读次数:
263
判断树是否是平衡的,这道题中的平衡的概念是指任意节点的两个子树的高度相差不超过1,我用递归的方法把所有的节点的高度都计算了下,并且在计算的过程记录每个节点左右两颗子树的高度差,最后通过遍历这个高度差就可以知道是否是平衡的。下面是AC代码:
1 /** 2 * Given a binary...
分类:
其他好文 时间:
2014-05-05 09:54:44
阅读次数:
378
elsevier 投稿时,将 .tex
文件上传到EES,总是不能够正确生成正文部分,而是一堆乱码,经过研究发现那些并非乱码,而是latex编译输出的信息。于是详细分析编译输出信息,发现提示错误“Latex
error:picins.sty not found”,于是上传“picins.sty” 包...
分类:
其他好文 时间:
2014-05-04 20:15:42
阅读次数:
360
Binary Stirling NumbersTime Limit:1000MSMemory
Limit:10000KTotal Submissions:1761Accepted:671DescriptionThe Stirling number of
the second kind S(n, m)...
分类:
其他好文 时间:
2014-05-04 19:34:32
阅读次数:
434
travel the binary tree by level 4 ( from down to top and from left to right every level )
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:tr...
分类:
其他好文 时间:
2014-05-04 18:22:16
阅读次数:
381
安装配置环境: os:centos
5.4 mysql:5.5.37 虚拟server1:mysql_master(192.168.40.241) 虚拟server2:mysql_slave(192.168.40.242)安装Mysql:
可参考解压后的INSTALL-BINARY,如下: shel...
分类:
数据库 时间:
2014-05-04 12:34:32
阅读次数:
516
travel the binary tree by level 2 ( from top to down )
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:travel the binary tree by level 2 (...
分类:
其他好文 时间:
2014-05-04 09:27:56
阅读次数:
334
travel the binary tree by level( from top to down)
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:travel the binary tree by level( from top t...
分类:
其他好文 时间:
2014-05-04 09:17:12
阅读次数:
292
travel the binary tree by level 3 ( from down to top )
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:travel the binary tree by level 3 ( f...
分类:
其他好文 时间:
2014-05-04 09:00:55
阅读次数:
294
the longest distance of a binary tree
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:the longest distance of a binary tree;
博客时间:2014-4-...
分类:
其他好文 时间:
2014-05-04 00:28:23
阅读次数:
446