Monotonic Function - Binary Search / Sorted Array

https://algo.monster/problems/binary-search-monotonic

1 Like

Very nice insight and intuition! thanks

Very insightfully indeed!

grammar error. you guys said ā€œA mononticā€ instead of monotonic in the first sentence under the graph

at this point, the subscription what I paid is rewarded.

The feasible function is supposed to be applied on the value not the index, right?
So based on my understanding, for example, in the python code on line 6, it should be feasible(arr[mid]) not feasible[mid]

Yes, I think there shoud be more clearly from definition of feasible function. In that ā€˜feasibleā€™ function there could be extraction from an original array based on ā€˜midā€™ index.

1 Like

But why not let mid = left + Math.floor((right - left) / 2)? for potential overflow
or i missing something?

it stated in the previous two lessons, that on python3, the integers can be arbitrarily large, so we donā€™t have to deal with overflow errors. on other coding languages though, you would use mid = left + math.floor((right - left) / 2)