New course! Every coder should learn Generative AI!
Try a free lesson+ 2
How can one implement the binary search with an unsorted data?
Search
6 Answers
+ 10
Well binary search cannot be implemented on an unsorted data.
It is pre-requisite for binary search that the data should be sorted.
+ 9
No problem, happy to help ๐
+ 2
That's what I had doubt about. Thanks for clearing it๐๐
+ 2
Please clarify, sir.
+ 1
Well, if the input array is not sorted, we can check for sorting, and also sort the data in the process. Then proceeding in the resulting array. That might work.
+ 1
Priyam Chaudhuri What does the second comment say?