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 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
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
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
question
Mathematics, 28.06.2020 19:01
Questions on the website: 13722363