首页 | 本学科首页   官方微博 | 高级检索  
     

改进的二分法查找
引用本文:王海涛,朱洪.改进的二分法查找[J].计算机工程,2006,32(10):60-62,118.
作者姓名:王海涛  朱洪
作者单位:复旦大学计算机科学与工程系,上海,200433
基金项目:中国科学院资助项目;科技部专项基金;上海市科技发展基金
摘    要:当前有很多的查找算法,其中在对有序数列的查找算法中二分法查找(binary search)是最常用的。利用二分法,在含有n个元素的有序数列中查找一个元素的最大比较次数为logn]+1。在很多情况中,在查找之前有序数列分布的很多信息为已知,比如说如果知道了有序数列中每相邻两个元素之差的最大值的一个上界,就可以有比二分法更加有效的查找算法。文章给出了一个称之为改进的二分法查找算法。改进的二分法查找性能明显优于二分法查找,受数列分布的影响,其最坏情况下查找一个元素的最大比较次数在1和logn]+1之间,明显优于二分查找的logn]+1。在实际应用中利用改进的二分法可以极大地提高查找效率。

关 键 词:查找  二分法  有序数列  算法
文章编号:1000-3428(2006)10-0060-03
收稿时间:2005-07-23
修稿时间:2005-07-23

Modified Binary Search
WANG Haitao,Zhu Hong.Modified Binary Search[J].Computer Engineering,2006,32(10):60-62,118.
Authors:WANG Haitao  Zhu Hong
Affiliation:Department of Computer Science and Engineering, Fudan University, Shanghai 200433
Abstract:Consider the problem of determining whether a given element x is in array. To solve the search problem, there are many algorithms. And binary search is the most common search algorithm if the array is sorted. The number of comparisons performed by binary search on a sorted array of size n is at most ?? log n ?? +1. The time cost of binary search reaches the lower bound of the search problem. But in many circumstances, some information about the array before search is known. If the upper bound of the maximum difference between any adjacent elements in the array is known, one can design a preferable algorithm. It is referred as modified binary search. In the worst case, the maximum number of comparisons performed by modified binary search is between 1 and ?? log n ?? +1, obviously better than binary search.
Keywords:Search  Binary search  Sorted array  Algorithm
本文献已被 CNKI 维普 万方数据 等数据库收录!
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号