Lab 02
Recursive Binary Search
Synopsis

Imagine you are given a collection of sorted data, and you want to find the position of a particular item. The naïve way to do this would be to search the collection, one element at a time, from left to right. However, instead we can narrow down on the element in question very quickly by continuously dividing the array in halves, using the following algorithm:

/* @param array A sorted array
 * @param target The number to find
 * @param first The leftmost index to search (integer)
 * @param last The rightmost index to search (inclusive, integer)
 */
Function Search(array, target, first, last)
If first > last
// Number not found
Else
midavg(first, last)
If target = array[mid]
resultmid
ElseIf target < array[mid]
result ← Search(array, target, first, mid - 1)
Else
result ← Search(array, target, mid + 1, last)
EndIf
EndIf
return result
EndIf
Specification

First, download the driver

Create a class BinarySearcher that contains the following static methods: You do not need a main method
Example Dialog:

    All values match.
    
Finally:

Upload the .java file to the dropbox

Make sure it conforms to the style guidelines