NO7——二分

 int binsearch(int *t,int k,int n)
{//t为数组,k是要查找的数,n为长度,此为升序
int low = ,high = n,mid;
while(low<=high)
{
mid = (low+high)/;
if(k == t[mid])
return mid;
else if(k<t[mid])
high = mid-;
else
low = mid+;
}
return -;
}
上一篇:Wannafly挑战赛22游记


下一篇:spring mvc 拦截器 拦截子目录