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
Which one can be used as watermark in a word document?​
otez555 [7]

Answer:

On the Design tab, select Watermark.

In the Insert Watermark dialog, select Text and either type your own watermark text or select one, like DRAFT, from the list. Then, customize the watermark by setting the font, layout, size, colors, and orientation. ...

Select OK.

4 0
3 years ago
Chelsea wants to know about the requirements for being a lab technician. Where could she find that information?
7nadin3 [17]
On a job application.
5 0
3 years ago
Identify the different groups of keys on a keyboard
kifflom [539]

Answer:alphabetic keys, numeric keys, function keys and special keys.

Explanation:

6 0
3 years ago
What happens to the Menu Bar when the<br> object (image, shape, etc.) is "active"?
nexus9112 [7]

Answer: Ok so Sorry about this but I will answer thing at 10:20 tommorow I promise

Explanation:

5 0
2 years ago
External network security threats can include management failure to support organization-wide security awareness, inadequate sec
Ganezh [65]

Answer:

The answer is "Option B".

Explanation:

In external networking, it establishes the informal links beyond the size of the firm, which supports its career, and these networks may be used for help, invaluable guidance.

This system would be a different point of view to provide the privacy protection for the system connectivity, and in the internal system protects its system protects all its data, that's why it is false.

6 0
3 years ago
Other questions:
  • Software that interprets commands from the keyboard and mouse is also known as the ​
    7·1 answer
  • Rewrite this method so that it avoids the use of a return statement:
    15·1 answer
  • In 1-2 paragraphs discuss the three main purposes of design and provide examples for each. Also explain how a design might serve
    15·1 answer
  • What's is the contribution of technology to the country?
    15·1 answer
  • The best how can i get. Ethiopian bank enterance examination for natural science grade 12?
    8·1 answer
  • Which types of computers are used by large businesses
    10·1 answer
  • Discuss how the use of digital formats for audio-visual recording and editing has
    8·1 answer
  • define the term computer hardware and its various types mentioning 5 examples of IP or devices with one diagram each​
    9·1 answer
  • What is the name of the first practical asymmetric cryptosystem that was created?
    15·1 answer
  • 40 points for this question
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!