折半查找也就是二叉查找,其查找时间复杂度为O(logn),比顺序查找的效率高得多,唯一的要求就是待查表已经有序。1、等值折半查找比较简单,算法如下:def binarySearch(data,value): low = 0 high = len(data) - 1 while lo...
分类:
其他好文 时间:
2014-07-26 00:50:56
阅读次数:
213
#includevoid MergeArray(int first,int mid,int last,int a[]){ int k=0; int i=first,j=mid+1; int n=mid,m=last; int c[100]; while(i<=n && ...
分类:
其他好文 时间:
2014-07-26 00:40:06
阅读次数:
216
公司一个数据抓取的程序,数据量极大,读取数据的用IDataReader的Read方法来进行数据处理,在测试的时候我想跑一部分数据后跳出循环,即break; 然后关闭datareader,但是在执行datareader.close()方法的时候出现了“超时异常”的错误, 查看了一下MSDN对Close...
分类:
其他好文 时间:
2014-07-26 00:17:36
阅读次数:
232
Swift采用类同c语言的流程控制语句,if, for, for-in, while, do-while , switch, break, continue .Swift语言的Switch语句自动添加了break效果,这样你可以不用没个case后面再写break.同c语言不同,swift语言的if ...
分类:
其他好文 时间:
2014-07-26 00:04:56
阅读次数:
365
1. 像函数一样使用的宏 //这个宏,用来被其他宏使用,构造一个正确有效的表达式。这个适合于一些离散语句的组合,不适合函数的重新命名 #define st(x) do { x } while (__LINE__ == -1) 例如:#define aps_GroupsRemaingCapacity(...
分类:
其他好文 时间:
2014-07-26 00:02:06
阅读次数:
505
word-breakoverflow-wrapword-wrap参考:你真的了解word-wrap和word-break的区别吗?Difference between overflow-wrap and word-breakoverflow: hidden;white-space: nowrap;t...
分类:
其他好文 时间:
2014-07-25 18:56:31
阅读次数:
216
不论是过去写的这个转换方法,还是今天看到的这个:string cvt2str( int x ){ int d = x; string ans = ""; while( x > 0 ) { d = x%10; ans = char(d+'0')+an...
分类:
编程语言 时间:
2014-07-25 16:40:51
阅读次数:
217
HashMap的几种遍历方法1、第一种: Map map = new HashMap(); Set keys = map.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { ...
分类:
移动开发 时间:
2014-07-25 16:35:21
阅读次数:
565
写个 crontab ,命令是类似这样的/path/to/script `date +%Y-%m-%d`直接运行很正常,但是在 crotnab 里就出错。/bin/sh: -c: line 1: unexpected EOF while looking for matching ``'/bin/sh...
分类:
其他好文 时间:
2014-07-25 14:02:15
阅读次数:
225
public class Thread1 extends Thread{ public void run(){ int i=0; while(i0){ i--; System.out.println(i); ...
分类:
编程语言 时间:
2014-07-25 13:49:21
阅读次数:
177