The binary search algorithm is extracted from Jon Bentley's # Programming Pearls 2nd ed. p.93
Satoru Takabayashi
gem "bsearch", "~> 1.5.0"