Question: If upperBound and lowerBound are called on the same array to search for the same value, like this: int idx 1 = BinarySearch.lowerBound ( a

If upperBound and lowerBound are called on the same array to search for the same value, like this:
int idx1= BinarySearch.lowerBound(a, value);
int idx2= BinarySearch.upperBound(a, value);
and the returned indices are the same (that is, idx1== idx2), then which of these is true?
There are no elements of a that are equal to value.
This can't happen; it is impossible for idx1 and idx2 to be equal.
There is exactly one element of a that is equal to value.
If upperBound and lowerBound are called on the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!