RosettaCodeData/Task/Binary-search/BASIC256/binary-search-2.basic
2023-07-01 13:44:08 -04:00

17 lines
395 B
Text

function binarySearchI(array, valor)
lb = array[?,]
ub = array[?]
while lb <= ub
mitad = floor((lb + ub) / 2)
begin case
case array[mitad] > valor
ub = mitad - 1
case array[mitad] < valor
lb = mitad + 1
else
return mitad
end case
end while
return false
end function