DS & Algo Problems — Binary Search Optimization

Binary Search is probably one of the most ‘interesting’ algorithm from our high school and sophomore college computer science course. But most of us have encountered binary search either in the context of searching in a sorted array or some tweaked versions of similar problem:
- Find an element in a rotated sorted array (with and without duplicates allowed).