K
Kiko Tores
If there is something wrong , could you please point it out ( if you
can give me an example as well)
int find( int array[], int size, int key )
{
int begin=0, end=size-1, middle;
while (end>begin){
middle = (begin+end) /2;
if (key>array[middle])
begin=middle+1;
else
end = middle;
}
if (key==array[end]) return end;
return -1;
}
can give me an example as well)
int find( int array[], int size, int key )
{
int begin=0, end=size-1, middle;
while (end>begin){
middle = (begin+end) /2;
if (key>array[middle])
begin=middle+1;
else
end = middle;
}
if (key==array[end]) return end;
return -1;
}