1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
avanturin [10]
2 years ago
12

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)
Computers and Technology
1 answer:
umka21 [38]2 years ago
5 0

Answer:

The answer is "Option D".

Explanation:

In the given question "(array, 3, 4, key) and (array, 4, 4, key)", the element 'e' to also be searched is concentrated mostly on the right-hand side of the array since it is in the last place. This same middle value is 2 but findMatch(array, mid + 1 high, key) is labeled twice to move the center pointer to its last position, that is, so move that search item's 'e.'

You might be interested in
Why did Hunter gatherers moved into the<br>America's?​
GrogVix [38]

Answer:

Explanation:

Hunter-gatherers are humans that get the food and living collecting wild plants and pursuing wild animals, this was the first human's adaptation, this people arrive to America from the Bering Strait from Asia Eurasia, they were following some prehistoric mammoths, and using primitive boats arriving at Pacific coast to South America.

8 0
3 years ago
Ineeedd help please 35 points question
vesna_86 [32]

Answer:

1

Explanation:

The four gates on the left are XNOR gates, their output is 1 if both inputs are equal. This is the case (given), so all inputs to the quadruple AND gate are 1, hence the output is also one.

7 0
3 years ago
Local television news networks cover only
Vika [28.1K]

Answer:

12 percent of international news

Explanation:

Just did it

3 0
3 years ago
Read 2 more answers
Software engineering design teams use ________, which are grounded in mathematical concepts of sets and relations, for their sof
zloy xaker [14]

Answer:

Relational Databases

Explanation:

These are digital databases that are made to recognize relations between previously stored items of info.

4 0
3 years ago
The work day has just started and you receive reports that the inventory management server is not accessible on your company's n
drek231 [11]

Answer:

Option 3 i.e., Server manager is the correct option.

Explanation:

The server manager is the MS windows tool for the purpose to examine and maintain the function of the server and alter the configuration. So, when the user gets the reports of the management server of the inventory or stock which is not usable by the company's server of the following user. Then, he recalls the new admin of the server. The server manager tool should be used by the admin of the server.

7 0
3 years ago
Other questions:
  • A plan that outlines the steps and timeline for reaching a certain goal is called a(n):
    13·1 answer
  • What does nntp stand for?
    12·2 answers
  • How to copy music from windows media player to pc?
    13·1 answer
  • Why is the ipad not considered to be an enterprise-worthy device
    8·1 answer
  • Peripherals can be used to output information.<br> True<br> False
    9·2 answers
  • "2. what are the advantages and disadvantages of using the serial console connection compared to the usb console connection to a
    15·1 answer
  • Assume that the following variables have been defined in a program: int x = 10; int y = 20; int z = 30; Write a cout statement t
    11·1 answer
  • Combining two or more cells to make one is called​
    8·1 answer
  • Computers that are joined together are called networks true or false
    10·1 answer
  • According to Chargaff's data, ________ must pair with ________, and ________ must pair with ________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!