intsearch(intarray[],intn,intv)
{
intleft, right, middle;
left = 0, right = n - 1;
while(left <= right)
{
middle = (left + right) / 2;
if(array[middle] > v)
{
right = middle;
}
elseif(array[middle] < v)
{
left = middle;
}
else
{
returnmiddle;
}
}
return-1;
}