← BYTES
Algorithms·Starter·Ref: 12.1.2

What is the precondition for binary search to work correctly on an array?

Have a question about this video? Mention reference 12.1.2 when you contact us.

a.The array must contain only even numbers
b.The array must have fewer than 100 elements
c.The array must already be sorted
d.The array must contain no duplicate values
Binary search repeatedly halves the search range by comparing the target to the middle element and discarding the half that can't contain it -- this logic only works correctly if the array is already sorted.

Find this on YouTube & Instagram

Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:

#BYTES#BYTES1212#Algorithms