- 博客(10)
- 收藏
- 关注
原创 单例模式
1、饿汉式public class SinglePattern { private SinglePattern(){ } private static SinglePattern instance=new SinglePattern(); private static SinglePattern getInstance(){ return instance; }}
2015-09-13 16:22:07
316
原创 MYSQL子查询
子查询可以简化SQL语句的编写,不过如果使用不当的话子查询会降低系统性能,为了避免子查询带来的性能问题,除了需要优化SQL语句之外还需要尽量降低使用子查询的次数。比如下面的子查询用来取得系统中所有年龄或者工资与Tom相同的人员:select * from T_person where age = (select age from T_person where name = 'Tom')or
2015-09-09 18:58:34
429
原创 SQL动态语句查询
要实现这种动态的SQL语句拼装,我们可以在宿主语言中建立一个字符串,然后逐个判断各个复选框是否选中来向这个字符串中添加SQL语句片段:String sql = "select * from employee where 1=1";if(工号复选框选中){ sql.appendLine("and number between "+工号文本框内容一+"and"+工号文本框内容二);}
2015-09-09 11:00:29
932
原创 最近公共祖先
打印路径#include#include#include#include#includeusing namespace std;struct TreeNode{ int val; TreeNode *left,*right;};TreeNode* createTree(){ int val; scanf("%d",&val); if(val==0) retur
2015-09-08 18:26:59
276
原创 排序算法
冒泡排序:每一次遍历过程中,依次比较相邻元素的大小,从而将最小的元素往上浮,时间复杂度为O(n^2)。void bubbleSort(int a[],int n){ int i,j; for(i=0;i<n-1;i++) //往上浮 { for(j=i;j<n-1;j++) { if(a[j]>a[j+1]) { swap(a[j],a[j+1]);
2015-09-07 21:11:22
241
原创 [LeetCode]Two Sum
本文地址:http://blog.youkuaiyun.com/morewindows/article/details/12684497转载请标明出处,谢谢。欢迎关注微博:http://weibo.com/MoreWindows
2014-07-23 18:33:11
343
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人