For integers 16 and 442, illustrate the algorithm for division. Be careful with positive and negative...
Prove the following version of the division algorithm, which holds for both positive and negative divisors. Extended Division Algorithm: Let a and b be integers with b = 0. Then there exist unique integers q and r such that a = bq + r and 0 sr<|bl| [ Hint: Apply Theorem 1.1 when a divided by [b]. Then consider two cases (b >0 and b < 0) Explain the answer and visible for read
9. (5 points) Please describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list. 10. (5 points) Please devise an algorithm that finds all modes. (Recall that a list of integers is nondecreasing if each term of the list is at least as large as the preceding term.) 11. (5 points) Please find the least integer n such that f() is 0(3") for each of these functions f()...
8. [10 points) Consider the following algorithm procedure Algorithm(: integer, n: positive integer; 81,...a s integers with vhilei<r print (l, r, mı, arn, 》 if z > am then 1:= m + 1 if za then anstwer-1 return answer 18 and the (a) Assume that this algorithm receives as input the numbersz-32 and corresponding sequence of integers 2 | 3 1 1 4151617| 8| 9 | 10 İ 11 İ 12 | 13 | 14|15 | 16 | 17 |...
9. [10 points) Consider the following algorithm: procedure Algorithm(n: positive integer; ddd: distinet integers) for k:=1 to n-1 for 1-1 to n-k print(k, I, di,da...-1,dn) if ds dti then interchange dy and d (a) Assume that this algorithm receives as input the integer n 6 and the input sequence 하하하하하하, Miss ^-ruteae rehen i12|3141516 Fill out the table below: ds ds (b) Assume that the algorithm receives the same input values as in part a). Once the algorithm finishes, what...
17. Consider the following algorithm: procedure Algorithm(n: positive integer; di,d2.. ,dn: distinct integers) for 1 to n-1 for 1 to n-k if ddi+ then interchange di and di+ print(k, I, d,ddn-1, dn) (a) |3 points Assume that this algorithm receives as input the integer-6 and the corresponding input sequence 41 36 27 31 17 20 Fill out the table below ds (b) 1 point Assume that the algorithm receives the same input values as in part a). Once the algo-...
For the data given below, answer parts (a) through (f). х y -21 101 - 18 121 - 16 119 - 15 131 - 11 141 (a) Draw a scatter plot. Choose the correct graph below. ОА. Q 150- OB O c. OD @ Q 150- 150- 150- -30 -30 0 -30 (b) Find the equation of the line containing the first and the last data points. (Type an equation. Type your answer in slope-intercept form. Use integers or fractions...
Question 2 (a) Define algorithm and give an example to illustrate it. [5 marks] (b) The following C program codes are given below 1.#include <stdio.h> 2. main() char s 1-"Bad"; 6 7 char s1 -"weather!"; char sen [20]; int i, ji for (i-0;i<20: ++i) 10. sen [i]-s [i]; else 12. 13. 14. 15. 16. 17 18. 19 sen [i++ for ( j-o;s1 [j] !-'\0 ' ; j ++ , i++) sen [i]-s1 [j break; 20. 21 22. sen [il-'1o puts...
Use the given data set to complete parts (a) through (C) below. (Use a = 0.05.) 10 9.14 8 8.15 13 8.74 9 8.77 11 9.27 14 8.09 6 6.13 4 3.09 12 9.13 5 4.75 7.26 Click here to view a table of critical values for the correlation coefficient. a. Construct a scatterplot. Choose the correct graph below. OA OB. OC. OD. AY 10- 8 10- 10 8 10- 8- 6 6- 6- . 6- 4 4 4- 4...
Use the given data set to complete parts (a) through (c) below. (Use a = 0.05.) 5 х у 10 9.14 8 8.14 13 8.73 9 8.76 11 9.26 14 8.09 6 6.13 4 3.09 12 9.13 7 7.25 4.73 Click here to view a table of critical values for the correlation coefficient. a. Construct a scatterplot. Choose the correct graph below. OA. OB. O c. OD y AY 10- 8- Ay 10-1 a 10- 10- 8- 6- 8-1 8-...
10 of 32 16 complete Suppose the birth weights of full-term babies are normally distributed with mean 3750 grams and standard deviation - 475 grams Complete parts (a) through (c) below (a) Draw a normal curve with the parameters labeled. Choose the correct graph below ОА. OB OC OD no a 3150 4335 4700 3975 800 2000 4730 (b) Shade the region that represents the proportion of full-term babies who weigh more than 4700 grams Choose the correct graph below...