find min using binary search