subject

List the resulting array after each call of the merge method. Indicate the number of character-to-character comparisons made for each call to merge (line 22 of the merge method at the end of the assignment). Sort the following array of characters into alphabetical order: C Q S A X B T. 01 public static void mergesort (char[] a, int i, int r){
02
03 if (1 >= r) {
04 return;
05 }
06 int middle = (1+r)/2;
07 mergesort(a, l, middle);
08 mergesort(a, middle+1, r);
09 merge(a, l, middle, r);
10 }
11
12 public static void merge (char[] a, int i, int m, int r){
13
14 //copy lower half of the array into b
15 char [] b = new char[m-1+1];
16 for (int i = 0; i <= m-1; i++ ) {
17 b[i] = a (1+i);
18 }
19
20 int i = 0, j m+1, k = 1;
21 while (i <= m-1 && j <= r ) {
22 if (a[j] < b[i]) {
23 a[j];
24 k += 1;
25 j += 1;
26 } else {
27 a[k] b[i];
28 k += 1;
29 i += 1;
30 }
31 }
32 while (i <= m-1) {
33 a[k] b[i];
34 k += 1;
35 i += 1;
36 }
37 while ( j <= r ) {
38 a[k] a[j];
39 k += 1;
40 j += 1;
41 }
42 }

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What is used to analyze and summarize your data without graphical support
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
question
Computers and Technology, 24.06.2019 11:20
Colby works as a shipping clerk for a major package delivery service. some of his daily tasks include tracking shipments and entering orders. which aspect of the information technology cluster would he most likely be trained in? a.networkingb.databasesc.hardwared.software
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Ahousehold consists of a married couple and their twin five-year old daughters. the couples children had no income and lived with their parents all of last year. how many exemptions can the couple claim on last years tax return or they file with the “ married filing jointly “ status? a. 4 b. 5 c. 3 d. 2
Answers: 1
You know the right answer?
List the resulting array after each call of the merge method. Indicate the number of character-to-ch...
Questions
Questions on the website: 13722367