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
Which of these are examples of a bug?
nadya68 [22]
The answer is b and c
7 0
3 years ago
If given the chance to own manage a business,what will be the name of the business?
Nady [450]
This is honestly an answer you can give. What would you name a business if you made one?
7 0
3 years ago
Read 2 more answers
What are the three fundamental principals of mnemonics? <br><br>HELP FASTTT!
muminat

Answer:

The three fundamental principles underlying the use of mnemonics are imagination, association, and location.

Explanation:

8 0
3 years ago
Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
s2008m [1.1K]

Answer:

Network.

Explanation:

The Transmission Control Protocol/Internet Protocol (TCP/IP) model is a standard networking protocol which allows network devices such as routers, switches, and host computers to interconnect and communicate with one another over a network. The Transmission Control Protocol/Internet Protocol (TCP/IP) model comprises of four (4) layers and these includes;

I. Application layer.

II. Transport layer.

III. Internet layer.

IV. Network layer.

The network layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two nodes.

Basically, this layer known as network layer is the fourth layer of the Transmission Control Protocol/Internet Protocol (TCP/IP) model and it is typically responsible for the transmission of packets from one network device to another.

4 0
3 years ago
The hypothalamus controls the anterior pituitary by means of: a. releasing hormones b. second messengers c. third messengers d.
scoundrel [369]

Answer:

a. releasing hormones

Explanation:

The hypothalamus controls the anterior pituitary by means of corticotropin-releasing hormone (CRH). The hormone CRH is encoded by the CRH gene on eighth human chromosome. The anterior pituitary in turn regulates other endocrine glands by means of Adrenocorticotrophic Hormone (ACTH). These actions form part of the Hypothalamic–pituitary–adrenal(HPA) axis which is one of the important neuroendocrine systems in humans.

7 0
3 years ago
Other questions:
  • Why should you thank the customer after resolving an issue?
    7·2 answers
  • What does this say:<br> √ans
    6·2 answers
  • Write a MARIE program to allow the user to input 8 integers (positive, negative, or zero) and then find the smallest and the lar
    15·1 answer
  • Write the sql command to show which tutor needs to be reminded to turn in reports.
    13·1 answer
  • Your bluetooth headset is waiting for another bluetooth device to locate its signal. what is this mode known as?'
    8·1 answer
  • Which of the following is the correct ordering of operating systems, oldest to newest?
    5·2 answers
  • How have productivity programs improved the professional lives of people? (check all that apply)
    8·2 answers
  • I neeeeeeeeeeeddddddddddddd help plz ppl
    10·2 answers
  • When do you use an else statement?
    10·1 answer
  • consider a pipelined risc cpu with 14 stages. what is maximum speedup of this cpu over a non-pipelined implementation?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!