数据结构二分法
来源:互联网 发布:java远程调用技术 编辑:程序博客网 时间:2024/05/16 05:50
- package per;
- public class Array1 {
- public int find(int searchKey, int[] array) {
- int lowBound = 0;
- int uppBound = array.length - 1;
- int curIndex;
- while (true) {
- curIndex = (lowBound + uppBound) / 2;
- if (array[curIndex] == searchKey) {
- return curIndex; //查找到数据,返回下标
- } else if (lowBound > uppBound) {
- break; //未查找到数据
- } else{
- if (array[curIndex] < searchKey) {
- lowBound = curIndex+1; //二分法 处于大的一半
- } else {
- uppBound = curIndex-1; //二分法 处于小的一半
- }
- }
- }
- return -1; //未找到则返回-1
- }
- }
- 数据结构二分法
- 数据结构之二分法
- 【数据结构】关于二分法
- 数据结构 之二分法查找
- [数据结构]二分法查找
- 图解数据结构二分法查找
- 数据结构基础_二分法查找
- 数据结构 -- 查找之 二分法查找
- 数据结构(C)---二分法随记
- 数据结构顺序查找与二分法
- 数据结构——二分法查找
- 数据结构——二分法查找
- 数据结构与算法之二分法插入排序
- 【数据结构与算法】有序数组二分法查找
- 二分法~~
- 二分法
- 二分法
- 二分法
- 关于Qt中脚本的几个概念
- 通过Win32API方式,将Excel嵌入Form窗体
- 观电视剧《新大秦帝国》
- 使用Custom.pll修改标准Form的LOV
- nfs:server is not responding,still trying问题
- 数据结构二分法
- 临时
- 使用Form个性化修改标准Form的LOV
- [UML] MVC的运作模式
- BI Publisher:限制每页打印的行数(Page Breaks)
- 孙鑫第12课笔记——文件和注册表的操作
- 实现IPv6:KAME项目的经验
- !!!
- [BusyBox] "Using fallback suid method" Message