How can one implement the binary search with an unsorted data? | Sololearn: Learn to code for FREE!
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

2nd Dec 2018, 3:00 PM
Bibaswan Roy
Bibaswan Roy - avatar
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.
2nd Dec 2018, 4:56 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 9
No problem, happy to help ๐Ÿ˜Š
2nd Dec 2018, 5:29 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 2
That's what I had doubt about. Thanks for clearing it๐Ÿ˜Š๐Ÿ˜Š
2nd Dec 2018, 5:18 PM
Bibaswan Roy
Bibaswan Roy - avatar
+ 2
Please clarify, sir.
2nd Dec 2018, 5:43 PM
Priyam Chaudhuri
Priyam Chaudhuri - avatar
+ 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.
2nd Dec 2018, 5:39 PM
Priyam Chaudhuri
Priyam Chaudhuri - avatar
+ 1
Priyam Chaudhuri What does the second comment say?
2nd Dec 2018, 5:41 PM
Bibaswan Roy
Bibaswan Roy - avatar