给定一个整数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
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
在做项目的时候遇到一个问题,以前双击grid页面一行数据的时候,会吧双击这一行的数据自动加载到双击的页面(Ext的弹出框),可以通过this.down(''form).getForm().loadRecord(record)来自动加载,可是现在有一个需求就是双击grid一行弹出一个新的浏览器页面(不...
分类:
Web程序 时间:
2014-07-07 20:33:29
阅读次数:
254
Spket是目前支持Ext 2.0最为出色的IDE。 它采用.jsb project file 文件并将继承于基类和所有文档的内容嵌入到生成代码提示的Script doc中。注:不支持配置项的代码提示。一、Spket Eclipse插件与IDE Spket提供了Eclipse插件和独立的IDE环境来...
分类:
Web程序 时间:
2014-07-07 18:40:44
阅读次数:
420
现象:以前一直正常的爬网突然无法顺利完成,总是在进行到某个部分就停滞不前。调查:在查看了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
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key....
分类:
其他好文 时间:
2014-06-27 09:15:12
阅读次数:
196