Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 13, 2022 05:56 pm GMT

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


Original Link: https://dev.to/rounit08/binary-search-is-not-for-sorted-arrays-only--2aba

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To