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 order.
You may assume no duplicates in the array。...
分类:
其他好文 时间:
2014-09-11 17:28:02
阅读次数:
207
题意:给你n个模式串,问一共有多少个模式串在文本串中出现过解题思路:对于多模式,单文本串的题目显然是要用 AC自动机来解决的,多文本串,单模式串,显然是要用KMP求解的,这也是KMP 和 AC自动机同为字符串匹配的不同之处。解题代码: 1 // File Name: temp.cpp 2 // .....
分类:
其他好文 时间:
2014-09-11 17:04:42
阅读次数:
195
function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(...
分类:
Web程序 时间:
2014-09-11 16:49:22
阅读次数:
184
转自:http://student.zjzk.cn/course_ware/data_structure/web/chazhao/chazhao9.2.1.htm顺序查找(Sequential Search) 在表的组织方式中,线性表是最简单的一种。顺序查找是...
分类:
其他好文 时间:
2014-09-10 19:30:10
阅读次数:
269
转自:http://student.zjzk.cn/course_ware/data_structure/web/chazhao/chazhao9.2.2.1.htm二分查找1、二分查找(Binary Search) 二分查找又称折半查找,它是一种效率较高的查找方法...
分类:
其他好文 时间:
2014-09-10 19:25:40
阅读次数:
305
http://tuichu.taobao.com/category-824349470.htm?spm=2013.1.w5002-7819446035.3.wHdSks&search=y&catName=%C6%F3%D2%B5%CD%F8%D5%BE%D4%B4%C2%EB
分类:
Web程序 时间:
2014-09-10 19:25:20
阅读次数:
214
转自:http://student.zjzk.cn/course_ware/data_structure/web/chazhao/chazhao9.2.3.htm分块查找 分块查找(Blocking Search)又称索引顺序查找。它是一种性能介于顺序查找和二分查找之间的查找方法。 1、 二分查找....
分类:
其他好文 时间:
2014-09-10 19:24:30
阅读次数:
273
首先获取searchView控件,比如在actionbar上获取: SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();if(searchView == null) { retu...
分类:
移动开发 时间:
2014-09-10 12:19:00
阅读次数:
1263
function getURL(){ var args = {}; var query = location.search.substring(1); //获得了当前链接的中?号后的参数 var pairs = query.split("&"); for(var i = 0; i < pairs.....
分类:
Web程序 时间:
2014-09-10 12:12:30
阅读次数:
202
1 public class Solution { 2 public boolean search(int[] A, int target) { 3 int low=0, high=A.length-1; 4 while (low=target) low=m...
分类:
其他好文 时间:
2014-09-09 23:02:39
阅读次数:
217