给定一个整数X和整数A0,A1,…,AN-1,后者已经预先排序并在内存中,求下标i使得Ai = X , 如果X不在数据中则返回i = -1 。明显的解法是从左往右扫描,花费线性时间。但是这个算法没有用到该表已经排序这个事实。折半检索(binary search,二分法检索)策略:/** * Perf...
分类:
其他好文 时间:
2014-07-16 23:25:47
阅读次数:
233
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easie...
分类:
Web程序 时间:
2014-07-16 23:25:24
阅读次数:
601
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
There are simply no limits on how many bags of jute and denim are available. You can find them in all sorts of patterns and colors that bring joy to u...
分类:
其他好文 时间:
2014-07-16 23:09:32
阅读次数:
190
https://help.ubuntu.com/community/Games/Native/QuakeIIIArenahttp://ubuntuforums.org/showthread.php?t=1977312http://www.cyberciti.biz/faq/linux-install...
分类:
系统相关 时间:
2014-07-10 14:03:21
阅读次数:
601
现象:以前一直正常的爬网突然无法顺利完成,总是在进行到某个部分就停滞不前。调查:在查看了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
题目大意:
分析长度为n的子串有多少种。
思路分析:
对于没出现的字符,将其分配一个数字。
然后将子串看做一个nc进制的数。
然后hash判断。
#include
#include
#include
#include
#include
#include
using namespace std;
bool vis[26666666];
int val[30...
分类:
其他好文 时间:
2014-06-27 09:45:35
阅读次数:
184
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
折腾了半天12.04server版,遇到的问题,貌似难度比10.04大很多:首先是低版本的ultraISO不支持12.04映像刻录,只显示出EFI,所以只能下个高版本的9.5.5(UUI被证明是不可行的)其次是按照10.04来做的话,Help->F6根本没有地方输入installcdrom-detect/try-usb=true。(找了好..
分类:
其他好文 时间:
2014-06-27 06:34:35
阅读次数:
233