1.什么是单例模式
单例模式的意思就是对于一个对象来说只有他的一个实例,不可以获取他的多个实例。
2.为什么要用单例模式
有一些地方必须要用到单例模式,或者有些地方使用单例模式可以大大提高程序的运行效率,比如数据库操作,每次进行数据库的操作都只需要数据库的一个连接对象就
可以了,如果每次进行数据库的操作都获得一个数据库的连接将会大大降低程序的运行效率,要知道进行一次数据库连接耗费的时间是...
分类:
其他 时间:
2015-01-30 22:42:07
收藏:
0 评论:
0 赞:
0 阅读:
332
重构的实践中。。。。...
分类:
其他 时间:
2015-01-30 22:41:57
收藏:
0 评论:
0 赞:
0 阅读:
306
题目链接:3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input...
分类:
其他 时间:
2015-01-30 22:41:47
收藏:
0 评论:
0 赞:
0 阅读:
278
题目: 七夕节Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4249 Accepted Submission(s): 1499 Problem Description七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字...
分类:
其他 时间:
2015-01-30 22:41:37
收藏:
0 评论:
0 赞:
0 阅读:
725
/*
2 编写一个业务函数,实现按行读取文件。把内容按照第三种内存模型打包数据传出,把行数通过函数参数传出。
函数原型有两个,任意选择其一
要求1:请自己任意选择一个接口(函数),并实现功能;70分
要求2:编写测试用例。30分
要求3:自己编写内存释放函数
*/
/*
2 编写一个业务函数,实现按行读取文件。把内容按照第三种内存模型打包数据传出,把行数通...
分类:
其他 时间:
2015-01-30 22:41:27
收藏:
0 评论:
0 赞:
0 阅读:
348
TokuMX2.0号称比MongoDB快50倍,同时完全兼容MongoDB 2.4的驱动。今天现在自己的开发机器上安装体验一下。首先下载,由于我是Ubuntu 14.10,目前还没有支持package安装方式,所以下载了压缩包,解压后放在/opt/tokumx-2.0.0-linux-x86_64之后,参考官方文档,添加链接:
$ ln -snf /opt/tokumx-2.0.0-linux-x...
分类:
其他 时间:
2015-01-30 22:41:17
收藏:
0 评论:
0 赞:
0 阅读:
367
题目链接:Letter Combinations of a Phone
Number
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone...
分类:
其他 时间:
2015-01-30 22:41:07
收藏:
0 评论:
0 赞:
0 阅读:
349
题目链接:4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note:
...
分类:
其他 时间:
2015-01-30 22:40:57
收藏:
0 评论:
0 赞:
0 阅读:
377
今天终于把万恶的期末考试给考完了!想想考的都是专业课,原本以为肯定会复习地很开心。因为不用像以前一样只是考试前一周什么都不会,然后考前疯狂地看书刷题,考完之后瞬间遗忘。不过事实证明...为了考试看书还是非常痛苦...即使是喜欢的算法,C++,操作系统....不过幸好已经考完啦!接下来为期四周的寒假又不用为考试而学习了!
大三上这一个学期接触的主要的东西依旧还是底层的系统和算法吧。在开学的第一个月...
分类:
其他 时间:
2015-01-30 22:40:47
收藏:
0 评论:
0 赞:
0 阅读:
396
题目链接:Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2.
After removing ...
分类:
其他 时间:
2015-01-30 22:40:17
收藏:
0 评论:
0 赞:
0 阅读:
329
题目链接:Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "...
分类:
其他 时间:
2015-01-30 22:40:07
收藏:
0 评论:
0 赞:
0 阅读:
258
UItableViewCell选中时的颜色及tableviewCell的select和deselect cell点击后再跳回当前页面cell的默认点击状态应该取消 pop返回或者push返回viewController时,cell自动取消选中状态...
分类:
其他 时间:
2015-01-30 22:39:57
收藏:
0 评论:
0 赞:
0 阅读:
499
...
分类:
其他 时间:
2015-01-30 22:39:47
收藏:
0 评论:
0 赞:
0 阅读:
338
这里布局和mainfest的定义省了,直接看样例
package com.example.message2;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickLis...
分类:
其他 时间:
2015-01-30 22:39:27
收藏:
0 评论:
0 赞:
0 阅读:
278
Connect
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 1148
Accepted: 375
Description
Figure 1
Figure 2
Figure 3a
Figure 3b
Figure...
分类:
其他 时间:
2015-01-30 22:39:07
收藏:
0 评论:
0 赞:
0 阅读:
337
package com.example.looper;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import and...
分类:
其他 时间:
2015-01-30 22:38:47
收藏:
0 评论:
0 赞:
0 阅读:
324
多边形的组成条件是最长边不能占边长总和的一半,将木棒想象成圆多砍一刀,然后是简单概率.
Polygon
Time Limit: 1000MS
Memory Limit: Unknown
64bit IO Format: %lld & %llu
Submit Status
Description
...
分类:
其他 时间:
2015-01-30 22:38:27
收藏:
0 评论:
0 赞:
0 阅读:
285
UITableViewCell自定义分割线 cell的分割线不能是整个屏幕的长度...
分类:
其他 时间:
2015-01-30 22:38:17
收藏:
0 评论:
0 赞:
0 阅读:
385
Clairewd’s message
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3621 Accepted Submission(s): 1388
Problem Description
Clairewd is...
分类:
其他 时间:
2015-01-30 22:38:07
收藏:
0 评论:
0 赞:
0 阅读:
604
题目大意:如上。有N个座位,第一个上去随意找位子坐。然后上去M个人,这M个人也随意
找位子坐,问第M个人坐到自己位子上的概率为多少。
思路:因为算上第1个人所有人都是随意坐,那么第M个人坐到正确位子上的概率和第1个人坐
到正确位子上的概率一样,都是1/N。...
分类:
其他 时间:
2015-01-30 22:37:47
收藏:
0 评论:
0 赞:
0 阅读:
246