摘要:
1intBinSearch(intArray[],intSizeOfArray,intkey/*要找的值*/)2{3intlow=0,high=SizeOfArray-1;4intmid;5while(low<=high)6{7mid=(low+high)/2;8if(key==Array[mid])9returnmid;10if(key<Array[mid])11high=mid-1;12if(key>Array[mid])13low=mid+1;14}15return-1;16}1intBinSearch(intArray[],intlow,inthigh,intkey/ 阅读全文