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]
3 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]3 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
2 red and 2 overlapping balls in the center are surrounded by a green, fuzzy, circular cloud with a white line running through i
luda_lava [24]

Answer: Label A: nucleus. Label B: Electron Cloud

Explanation: I got it right

8 0
3 years ago
Read 2 more answers
What is the speed of Android operating system?
NemiM [27]

Answer:

There isn't an exact android speed due to a variety of androids. But there are very fast like the HTC 10 or a Samsung Galaxy.

Explanation:

6 0
3 years ago
Pls answer this
trapecia [35]

Answer:

It looks like an Acme thread.

Explanation:

5 0
3 years ago
1. Import it into Eclipse. Open the file in Eclipse 2. Edit the file to add comments to identify the instance variables, constru
natita [175]

Answer:

/

Explanation:

3 0
3 years ago
What steps will change an existing macro? Use the drop-down menu to complete the steps.
Aneli [31]

Answer:

1. View

2. View macros

3. Edit

Explanation: completed on edge

6 0
3 years ago
Read 2 more answers
Other questions:
  • I need some cool things to do with windows command prompt.
    13·1 answer
  • Describe the "Mister Splashy Pants" campaign. How did it start? What happened?
    7·2 answers
  • The variable sentence stores a string. Write code to determine how many words in sentence start and end with the same letter, in
    13·1 answer
  • Write the definition of the word "log" as it would be used in relation to digital literacy
    13·1 answer
  • What effect does the comma style format have on the selected cells?
    13·1 answer
  • A computer is an electronic device operating under the control of instructions stored in its own memory that can accept, manipul
    11·1 answer
  • By using the internet, your company can obtain discounts thorugh...
    15·2 answers
  • How would asking questions or defining problems be used in this career?<br> -
    13·1 answer
  • What section in an ethernet frame will you find a Virtual Local Area Network (VLAN) header?
    6·1 answer
  • What is the purpose of a router
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!