Modify BinarySearch (Program 4.2.3) so that if the search key is in the array, it returns the

Question:

Modify BinarySearch (Program 4.2.3) so that if the search key is in the array, it returns the smallest index \(i\) for which \(a[i]\) is equal to key, and otherwise returns \(-i\), where \(i\) is the smallest index such that \(a[i]\) is greater than key.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: