Question

In: Computer Science

1. Show the steps in merging A and B into C where A= 8, 12, 19,...

1. Show the steps in merging A and B into C where

A= 8, 12, 19, 34 B= 3, 5,15, 21

Solutions

Expert Solution

steps in merging A and B into C where
A= 8, 12, 19, 34
B= 3, 5,15, 21

First two numbers in the array are 8 and 3.
minimum is 3.
Print 3 and remove 3 from list.
A= 8, 12, 19, 34
B= 5,15, 21

First two numbers in the array are 8 and 5.
minimum is 5.
Print 5 and remove 5 from list.
A= 8, 12, 19, 34
B= 15, 21

First two numbers in the array are 8 and 15.
minimum is 8.
Print 8 and remove 8 from list.
A= 12, 19, 34
B= 15, 21

First two numbers in the array are 12 and 15.
minimum is 12.
Print 12 and remove 12 from list.
A= 19, 34
B= 15, 21

First two numbers in the array are 19 and 15.
minimum is 15.
Print 15 and remove 15 from list.
A= 19, 34
B= 21

First two numbers in the array are 19 and 21.
minimum is 19.
Print 19 and remove 19 from list.
A= 34
B= 21

First two numbers in the array are 34 and 21.
minimum is 21.
Print 21 and remove 21 from list.
A= 34

There is only one number at last.
So, it prints 34.

Values printed in order are
3, 5, 8, 12, 15, 19, 21, 35 

Related Solutions

A B C 8 24 19 12 16 28 22 22 24 15 14 31 18...
A B C 8 24 19 12 16 28 22 22 24 15 14 31 18 20 19 9 32 Test at the 5% level of significance to see if the means are all the same. 1. What is the null and alternate hypotheses? 2. What is the p-value? 3. Decide if you reject or accept (fail to reject) your null hypothesis. 4. Decide if you reject or accept (fail to reject) your claim.
discrete mathematics 1.  Show that if a | b and b | a, where a and...
discrete mathematics 1.  Show that if a | b and b | a, where a and b are integers, then a = b or a = -b.   //Ex. 5, Page 208. 2. Show that if a, b, c, and d are integers such that a | c and b | d, then ab | cd. //Ex. 6, Page 208.  3. What are the quotient and remainder when a) 44 is divided by 8? b) 777 is divided by 21? f)...
a+b+c=(abc)^(1/2) show that (a(b+c))^(1/2)+(b(c+a))^(1/2)+(c(a+b))^(1/2)>36
a+b+c=(abc)^(1/2) show that (a(b+c))^(1/2)+(b(c+a))^(1/2)+(c(a+b))^(1/2)>36
If the percent recombination between A and B is 12, Between A and C 4, and between B and C is 8 then the order of the genes on the chromosome is?
  1. If the percent recombination between A and B is 12, Between A and C 4, and between B and C is 8 then the order of the genes on the chromosome is?   2. A man who is homozygous for type A blood has a child with a woman who is homozygous for type B blood. What is the probability that this child will have type AB blood?   3. In familial hypercholesterolemia, individuals homozygous for the allele...
-Let O (0,0,0) be the origin and A(a+1,b,c) where a,b and c are the last three...
-Let O (0,0,0) be the origin and A(a+1,b,c) where a,b and c are the last three digits of your student ID. Find, describe and sketch the set of points P such that OP is perpendicular to AP - Let u=<a , b+1 , c+1> find and describe all vectors v such that |u x v|=|u| a=1 , b=1 , c=9
if A and B are independent events where P(A) = 0.7 and P(B)= .8: 1. P(A...
if A and B are independent events where P(A) = 0.7 and P(B)= .8: 1. P(A ^ B) = 2. P(~A^~B) = 3.P(A U B) = 4. Does your anwser change if they were dependent?
Activity Duration Predecessor Cost A 8 - 25000 B 12 - 42000 C 7 A 18000...
Activity Duration Predecessor Cost A 8 - 25000 B 12 - 42000 C 7 A 18000 D 10 A 27000 E 14 B,C 46000 F 5 B,C 12000 G 3 D,E 7000 H 12 D,E 42000 I 10 F,G 36000 Consider the following project data. Assume costs are incurred upon completion of an activity. At the end of the project a lump sum payment of 340,000 is to be made. a) Find the net present value of the project at...
Show that the set of all real numbers of the form a+b sqrt(2)+c sqrt(3)+d sqrt(6),where a,b,c,d...
Show that the set of all real numbers of the form a+b sqrt(2)+c sqrt(3)+d sqrt(6),where a,b,c,d ∈Q, forms a subfield of R
Let A and C be a pair of matrix where the product AC exists. 1. Show...
Let A and C be a pair of matrix where the product AC exists. 1. Show that rank(AC) ≤ rank(A) 2. Give an example such that rank(AC) < rank(A) 3. is rank(AC) ≤ rank(C) always true? if not give a counterexample.
Convert the base-10 number to Two’s Complement. Show your work. (a) −12 (b) −32 (c) −57...
Convert the base-10 number to Two’s Complement. Show your work. (a) −12 (b) −32 (c) −57 (d) −112 (e) −24 (f) −85
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT