只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2015-10-27 16:41 代码的搬运工 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 二分查找需要注意两个问题一个是临界问题,流行的方案是左开右闭区间方式,还有一个就是当数组元素中有多个相同待查找值的应该返回第一个,下面的代码可以解决这问题,记录一下,由于最近开始用gvim编程了,请原谅我的中式英语注释。 1 /* 2 * binary search from programing... 阅读全文
posted @ 2015-10-27 16:15 代码的搬运工 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 *binary search 3 *just return a value position equals the find but may not the first one 4 *we should caution the left open right close or left close and right close rules to not happe... 阅读全文
posted @ 2015-10-27 16:11 代码的搬运工 阅读(213) 评论(0) 推荐(0) 编辑