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
Introduction To Programming In Java An Interdisciplinary Approach
ISBN: 9780672337840
2nd Edition
Authors: Robert Sedgewick, Kevin Wayne
Question Posted: