int Search_BIn(SSTable ST,KeyType key)
{
int low=1,high=ST.length;
int mid;
while(low<=high)
{
mid=(low+high)/2;
if(EQ(key,ST.elem[mid].key))return mid;
else if(LT(key,ST.elem[mid].key))high=mid-1;
else low=mid+1;
}
return 0;
}
数据结构:有序表折半查找
最新推荐文章于 2022-08-04 23:41:27 发布