问题:给一个二叉树,写一个算法判断这个树是不是balanced。Solution
#1.第一次遇到这个问题时我的解法,如下:public class Solution { public boolean isBalanced(TreeNode
root) { if(root == ...
分类:
其他好文 时间:
2014-05-05 12:50:49
阅读次数:
263
最近SDK出问题了,然后在google下载了一个android-sdk-windows.rar,然后点击SDK Manager,结果一直不能刷新API
Level,然后就开始在网上找了好多资料,解决这个问题,修改 HOSTS, HTTP 和 HTTPS 都不能解决,这给我带来了很大的困惑! 加载不出...
分类:
移动开发 时间:
2014-05-05 11:58:55
阅读次数:
534
判断树是否是平衡的,这道题中的平衡的概念是指任意节点的两个子树的高度相差不超过1,我用递归的方法把所有的节点的高度都计算了下,并且在计算的过程记录每个节点左右两颗子树的高度差,最后通过遍历这个高度差就可以知道是否是平衡的。下面是AC代码:
1 /** 2 * Given a binary...
分类:
其他好文 时间:
2014-05-05 09:54:44
阅读次数:
378
这两道题,大同小异。
我都是用BFS,在遍历的过程,判断结构是否相同/对称,值是否相同。下面是AC代码: 1 /** 2 * Given a binary tree, check
whether it is a mirror of itself (ie, symmetric aroun...
分类:
其他好文 时间:
2014-05-05 09:48:26
阅读次数:
401
BFS以及它的扩展,我发现栈是个很好用的数据结构,特别是对于顺序需要颠倒的时候!!!这里有个重要的信息:可以用null来标识一个level的结束!!!下面是AC代码:
1 /** 2 * Given a binary tree, return the bottom-up level ord...
分类:
其他好文 时间:
2014-05-05 09:46:06
阅读次数:
402
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
今天在学习JDBC的时候看到了关于MySql的事务的隔离级别的问题,感觉内容挺高级的,所以记录一篇文章,以备后面使用。
数据库隔离级别有四种,应用《高性能mysql》一书中的说明:
然后说说修改事务隔离级别的方法:
1.全局修改,修改mysql.ini配置文件,在最后加上
1 #可选参数有:READ-UNCOMMITTED, READ-CO...
分类:
数据库 时间:
2014-05-04 18:56:12
阅读次数:
450
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
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