标签:ima 检索 com alt 二分 else sea binary arc
int BinarySearch(int a[], const int &x, int lef, int rig)
{
if(lef <= rig)
{
int mid = (lef + rig) /2;
if(x == a[mid])
return mid;
else if(x > a[mid])
return BinarySearch(a, x, mid+1, rig);
else
return BinarySearch(a, x, lef, mid-1);
}
}
标签:ima 检索 com alt 二分 else sea binary arc
原文地址:https://www.cnblogs.com/Nicholastwo/p/9356916.html