给定一个整数X和整数A0,A1,…,AN-1,后者已经预先排序并在内存中,求下标i使得Ai = X , 如果X不在数据中则返回i = -1 。明显的解法是从左往右扫描,花费线性时间。但是这个算法没有用到该表已经排序这个事实。折半检索(binary search,二分法检索)策略:/** * Perf...
分类:
其他好文 时间:
2014-07-16 23:25:47
阅读次数:
233
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:
其他好文 时间:
2014-07-16 23:16:32
阅读次数:
156
摘自:HERE理解Java泛型最简单的方法是把它看成一种便捷语法,能节省你某些Java类型转换(casting)上的操作:List box = ...; Apple apple = box.get(0); 上面的代码自身已表达的很清楚:box是一个装有Apple对象的List。get方法返回...
分类:
编程语言 时间:
2014-07-16 23:16:15
阅读次数:
273
curl http://xxx.com/address/addresslist\?search\=%40 --cookie oa_cookie=123 -s| node parss.js js 代码var jsdom = require('jsdom') ,fs = require('fs...
分类:
Web程序 时间:
2014-07-10 13:58:50
阅读次数:
161
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2014-07-10 12:37:21
阅读次数:
189
简介grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。Unix的grep家族包括grep、egrep和fgr...
分类:
系统相关 时间:
2014-07-10 11:37:34
阅读次数:
402
display:box;box-flex是css3新添加的盒子模型属性,它的出现可以解决我们通过N多结构、css实现的布局方式。经典的一个布局应用就是布局的垂直等高、水平均分、按比例划分。目前box-flex属性还没有得到firefox、Opera、chrome浏览器的完全支持,但可以使用它们的私有...
分类:
Web程序 时间:
2014-07-10 09:56:16
阅读次数:
238
现象:以前一直正常的爬网突然无法顺利完成,总是在进行到某个部分就停滞不前。调查:在查看了log文件后,发现了这条错误06/24/2014 11:14:51.86 NodeRunnerQuery1-734f5ee7-2cc2- (0x0DD4) 0x14A0 Search C...
分类:
其他好文 时间:
2014-06-27 22:28:18
阅读次数:
262
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord...
分类:
其他好文 时间:
2014-06-27 22:25:10
阅读次数:
443
网页宽度页面box不要写宽度或width:100%之类的去掉头部加上下面代码:<metaname="viewport"content="width=device-width,initial-scale=1.0,minimum-scale=0.5,maximum-scale=2.0,user-scalable=yes"/>图片宽度<scripttype="text/javascript">functioninit(){varji..
分类:
移动开发 时间:
2014-06-27 07:05:34
阅读次数:
239