define BinarySearch(A, value); lvars low = 1, high = length(A), mid; while low <= high do (low + high) div 2 -> mid; if A(mid) > value then mid - 1 -> high; elseif A(mid) < value then mid + 1 -> low; else return(mid); endif; endwhile; return("not_found"); enddefine; /* Tests */ lvars A = {2 3 5 6 8}; BinarySearch(A, 4) => BinarySearch(A, 5) => BinarySearch(A, 8) =>