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
What is software engineering? What are the objectives of software engineering?
Mashutka [201]

Answer:

The basic objective of software engineering is to develop methods and procedures for software development that can scale up for large systems and that can be used consistently to produce high-quality software at low cost and with a small cycle of time.

Explanation:

7 0
2 years ago
What element is not a selection in the Interface preferences? UI Character Presets UI Font Size UI Language UI Scaling
Dovator [93]

Answer:

The element is not a selection in the Interface preferences is:

UI Character Presets

Explanation:

The interface preferences is a  section of the Set Preferences dialog, which contains settings related to the user interface for the display and configuration of certain features and dialogs, in accordance with the user's preferences.  They include the UI Font Size, UI Language, and UI Scaling, with the exception of the the UI Character Presets.  The UI Scale is the frontend extension of the actual screen resolution to the user.  The UI Language configures the user's preferred language, just as the UI Font Size allows the user to choose a preferred font size for display on the screen.

6 0
3 years ago
The physical elements needed for the production of digital media, such as computers, servers, and so on are called the {Blank}
deff fn [24]
They are called the hardware
8 0
3 years ago
Student creates a Raptor program and uses the File Input and Output method to find the average of 5 test scores stored in a text
masya89 [10]

Answer:

The question was solved using an algorithm later translated to a flow chart that adds five scores giving the sum and calculating the average.

Explanation:

4 0
3 years ago
Assessment timer and count Assessment items Item 6 How many different keys can be used in a single sort? 1 2 3 4
Alik [6]

Answer:

Its C 3. hope this helps

Explanation:

6 0
3 years ago
Other questions:
  • Failure to verify information can lead to?
    10·1 answer
  • Which of the following is not a job title associated with a career in visual and audio technology? master control operator produ
    9·1 answer
  • The Active Directory Users and Computers tool can be used to:______.
    11·1 answer
  • Sarah is creating and formatting a newsletter for her school. Which page layout rules should she consider when doing this?
    13·2 answers
  • It takes 2.5 yards of material to make a dress harleys clothing design estimates that they can produce 48 dresses each week.if t
    15·2 answers
  • What does Putting a word in quotation marks on your search bar do on google?
    12·1 answer
  • Why won't Brainly let me send a link? This is just du*mb! I want to send good articles explaining a content, and this site just
    5·1 answer
  • Ten examples of an interpreter
    8·1 answer
  • Write the line of Python code that calculates and prints the answer to the following arithmetic expressions.
    7·1 answer
  • One limitation of high-level programming languages is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!