DEV Community

Rounit Ranjan Sinha
Rounit Ranjan Sinha

Posted on

Binary search is not for sorted arrays only !

While talking about ' Binary Search ' , we consider that it will only work for "Sorted arrays" , but that's not the condition.

It will work for " Unsorted arrays" also ,

yes but only one kind of "unsorted array" ,
i.e., The Rotated Array.

It can be done in O(log n) time complexity , like a binary search , but it uses different method .
It uses "adjusted divide and conquer algorithm"
The DAC👍

And ssshhhh 🤫 it will be solved recursively only

Top comments (0)