subject

In the recursive function findMatch(), the first call is findMatch(array, 0, 4, key) . What are the remaining function calls to find the character 'e'? 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;
}
public static void main(String args[]){
char array[] = {'a','b','c','d','e'};
char key = 'e';
int result = findMatch(array, 0, 4, key);
if (result == -1) {
System. out. println("Element not found!");
}
else {
System. out. println("Element found at index: " + result);
}
}
}
a. (array, 2, 4, key) and (array, 3, 4, key)
b. (array, 2, 4, key), (array, 3, 4, key) and (array, 4, 4, key)
c. (array, 3, 4, key)
d. (array, 3, 4, key) and (array, 4, 4, key)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Amanda needs to create an informative print brochure for her local library’s fundraiser dinner. what critical detail must she have before she starts designing the brochure?
Answers: 1
question
Computers and Technology, 23.06.2019 05:20
Which operating system is a version of linux?
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
You know the right answer?
In the recursive function findMatch(), the first call is findMatch(array, 0, 4, key) . What are the...
Questions
Questions on the website: 13722363