二分(更新中)
int BinarySearch(int *a,int &e,int n)//在递增序数组a中找x
{
int left=0;
int right=n-1;
while(left<=right)//<=
{
int mid=(left+right)/2;
if(e>a[mid]) left=mid+1;
else
if(e<a[mid]) right=mid-1;
else
if(e==a[mid]) return mid;
}
return -1;//未找到e
}