added an alternative formulation of binary search