contains.rb
def contains(v, vs)
if vs.length == 0
return false;
end
left = 0; right = vs.length
while left + 1 < right
mid = left + (right - left) / 2;
if v < vs[mid]
right = mid
else
left = mid
end
end
return v == vs[left];
end
vs = [*1..10000000]
p contains(100, vs)