Computer Science, asked by shubhamkataria7081, 1 year ago

Why sorted array is used in binary search algorithm?

Answers

Answered by lichidash48pbhfh2
0
binary search can only be done in a sorted array as binary search is based on elements in order to check if the element is prior to it or after it. For example:
if we have to search 15 in an unsorted array of 1,78,34,23,15; then binary search won't be possible as you won't be sure if the element lies before the a certain element or after it.
I hope that was useful enough! 
Similar questions