Question: Write java class BinarySearch that uses recursion to find the index of a target value in an ascending sorted array. If not found, the result
Write java class BinarySearch that uses recursion to find the index of a target value in
an ascending sorted array. If not found, the result is -1.
Use BinarySearchDriver.java to drive the BinarySearch class
/*************************************************************
* BinarySearchDriver.java
* Student Name
*
*.
*************************************************************/
public class BinarySearchDriver
{
public static void main(String[] args)
{
int[] array = new int[] {-7, 3, 5, 8, 12, 16, 23, 33, 55, 88};
System.out.println(BinarySearch.binarySearch(
array, 0, (array.length - 1), 16));
System.out.println(BinarySearch.binarySearch(
array, 0, (array.length - 1), 50));
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
