Question: Identify the base case in the following code. public class FindMatch { public static int findMatch ( char array [ ] , int low, int

Identify the base case in the following code.
public class FindMatch {
public static int findMatch(char array[], int low, int high, char key){
if (high >= low){
int mid = low +(high - low)/2;
if (array[mid]== key){
return mid;
}
if (array[mid]> key){
return findMatch(array, low, mid, key);
}
else {
return findMatch(array, mid +1, high, key);
}
}
return -1;
}
}
Group of answer choices
if (high>=low)
if (array[mid]== key)
if (array[mid]> key)
int mid = low +(high - low)/2;

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!