摘要: 双调数组是指所有元素先递增后递减的数组,对其进行二分查找时,应先用二分查找找出数组中的最大项,再对左右两个单调子数组进行二分查找。代码如下:Item BitonicSearch(Item bitonicArray[],int length,int searchKey){ if((bitonicArray == NULL) || (lenght <= 0)) { return NULLItem; } int indexOfMaxItem = GetIndexOfMaxItem(bitonicArray,length); // 获取针对双调数组的递增部分的搜索结果 Item result = 阅读全文
posted @ 2013-12-14 10:55 姚来飞 阅读(633) 评论(0) 推荐(0) 编辑