折半查找
int fun(int *a,int left,int right,int x)
{
int mid;
int num=-1;
mid=(left+right)/2;
if(left<=right)
{
mid=(left+right)/2;
if (x>a[mid])
{
num=fun(a,mid+1,right,x);
}
else if (x<a[mid])
{
num=fun(a,left,mid-1,x);
}
else
{
num=mid;
}
}
return num;
}