`
blue2048
  • 浏览: 178523 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
这个提跟Binary Tree Level Order Traversal 一样,只是结果集用栈 /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public List<List<In ...
这个提跟Binary Tree Level Order Traversal 一样,只是结果集用栈     /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public List<List ...
事件传播 ApplicationContext基于Observer模式(java.util包中有对应实现),提供了针对Bean的事件传 播功能。通过Application. publishEvent方法,我们可以将事件通知系统内所有的 ApplicationListener。   事件传播的一个典型应用是,当Bean中的操作发生异常(如数据库连接失败),则通过事件传播 机制通知异常监听器进行处理。在笔者的一个项目中,就曾经借助事件机制,较好的实现了当系统 异常时在监视终端上报警,同时发送报警SMS至管理员手机的功能。
在很多情况下,我们需要为系统提供可配置化支持,简单的做法可以直接基于Spring的标准Bean来配置,但配置较为复杂或者需要更多丰富控制的时候,会显得非常笨拙。一般的做法会用原生态的方式去解析定义好的xml文件,然后转化为配置对象,这种方式当然可以解决所有问题,但实现起来比较繁琐,特别是是在配置非常复杂的时候,解析工作是一个不得不考虑的负担。Spring提供了可扩展Schema的支持,这是一个不错的折中方案,完成一个自定义配置一般需要以下步骤: 设计配置属性和JavaBean 编写XSD文件 编写NamespaceHandler和BeanDefinitionParser完成解析工作 编写sp ...
广度遍历的基础上,再使用是个集合存储下一层节点,在队列进元素的时机上做出一些改变,就能达到层级遍历树的效果   /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public List<Lis ...
递归生成二叉查找树 /** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public TreeNode sortedArrayToBST(int[] num) { if(num. ...
递归构造二叉查找树   /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; next = null; } * } */ /** * Definition for binary tree * public class TreeNode { * int val; * ...
翻译自 http://www.javaworld.com/javaworld/jw-01-2009/jw-01-spring-transactions.html?page=1   在Spring中常常使用JTA以及XA协议来实现分布式事务,不过我们也有其他选项。最佳实现取决于你的应用场景,比如使用什么类型的资源,如何在性能、安全、可靠性和数据完整性之间权衡。在这个系列文章中,来自SpringSource的David Syer将详细讲解Spring应用程序可以使用的7种分布式事务模式,其中3种使用XA,4种不使用XA。 级别: 中级 Spring框架对JTA(Java事务应用接口即Jav ...
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public boolean isBalanced(TreeNode root) { int b = b(root); ...
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public int minDepth(TreeNode root) { if(root==null){ ...
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public void flatten(TreeNode root) { if(root == null){ ...
转自: http://blog.csdn.net/bluishglc/article/details/7612811    1.XA   XA是由X/Open组织提出的分布式事务的规范。XA规范主要定义了(全局)事务管理器(Transaction Manager)和(局部)资源管理器(Resource Manager)之间的接口。XA接口是双向的系统接口 ...
转载:http://www.sqlparty.com/mysql-metadata-lock%E6%B7%B1%E5%85%A5/参考:http://www.cnblogs.com/cchust/p/3826398.htmlmetadata lock的超时时间是lock_wait_timeout,并不是innodb_lock_wait_timeout MySQL 5.5.3版本中引入了Metadata lock: DDL语句打破了事务的隔离级别     ...
/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class Solution { public List<List<Integer>> pathSum(TreeNode root, int sum) { ...
采用递归的方法,将累计的和值逐层下推   public boolean hasPathSum(TreeNode root, int sum) { return eSum(root, 0, sum); } private boolean eSum(TreeNode node, int s, int sum){ if(node == null){ return false; } s += node.val; if(node.left==null & ...
Global site tag (gtag.js) - Google Analytics