binary search for ruby