Match the algorithms described in pseudocode on the left with the description of what it does on the right.
1. Procedure A(a1, a2, ..., a(n): integers)
x=a1
for i = 2 to n
if x < a(i) then x = a(i)
return x
2. Procedure B(a1, a2, ..., a(n): integers)
x=a1
for i = 2 to n
if x > a(i) then x = a(i)
return x
3. Procedure C(a1, a2, ..., a(n): integers)
x=a1
for i = 2 to n
x = x + a(i)
return x
4. Procedure D(a1, a2,... , a(n): integers)
x=a1
for i = 2 to n
if x = x + ai
return x/n

Answers

Answer 1

Procedure A: Finds and returns the maximum value among a list of integers. Procedure B: Finds and returns the minimum value among a list of integers. Procedure C: Calculates the sum of all integers in a list and returns the result. Procedure D: Calculates the average value of a list of integers and returns the result.

Procedure A compares each element of the list with the current maximum value (initialized as the first element) and updates the maximum value if a larger element is found. It returns the maximum value.

Procedure B is similar to Procedure A but finds the minimum value among the list of integers. It compares each element with the current minimum value and updates the minimum value if a smaller element is found. It returns the minimum value.

Procedure C calculates the sum of all integers in the list by iterating through the elements and adding each one to the current sum. It returns the final sum.

Procedure D calculates the average value of the list by summing up all the elements and dividing the sum by the total number of elements (n). It returns the average value (sum divided by n).

Learn more about  integers here: https://brainly.com/question/18411340

#SPJ11


Related Questions

Other Questions
Which statement is correct about the total number of functions from {a,b,c; to {1,21?(A) The total number of functions from (1,2) to {a,b,c) is 9, and the number that are onto is 6.(B) The total number of functions from (1,2) to {a,b,c) is 8, and the number that are onto is 6.(C) The total number of functions from (1,2} to (a,b,c} is 9, and the number that are onto is 4.(D) The total number of functions from {1,2) to {a,b,c) is 8, and the number that are onto is 4. Organizational objectives and supply objectives typically are expressed:a. differently, making it difficult to translate organizational objectives into supply objectives.b. differently, providing the supply manager multiple opportunities to tap into organizational resources.c. the same (survival, growth, financial, and environmental), but long-term at the organizational level and short-term at the supply level.d. the same factors (quality, quantity, price, delivery and service), but long-term at the organizational level and short-term at the supply level.e. in ways that are very specific to the organization, making it difficult to convey objectives to suppliers. which outpatient is at a greater risk for developing treponema pallidum, the cause of syphilis? select all that apply. Let . Then lim h-0 f(x+h)-f(x) h f(x) = x - 2x + 7. 8. Find the flux of the vector field F= (-yx.1) across the cylinder y = 5x?, for OsXs2,0528 1. Normal vectors point in the general direction of the positive y-axis. Parametrize the surface using u=x and Describe and compare different types of databases in terms of data visualizations also Provide detailed explanations and examples in contrast to each other databases. Find parametric equations for the tangent line to the curve with the given parametric equations at the specified point.x=e^t ,y=te^t ,z=te^(t^2) ; (1,0,0) what does it mean in cuny first when it sayd you have a hold on your record. the hold on your record must be removed before this transaction can be processed. Relation R has schema:CREATE TABLE R (a INT PRIMARY KEY,b INT DEFAULT 0,c INT NOT NULL);R is currently empty. Develop a test that determines whether an insertion into R is currently legal. Then apply your test to determine which of the following INSERT statements is allowable.a)INSERT INTO R(c) VALUES(0);b)INSERT INTO R(a,b) VALUES(1,2);c)INSERT INTO R(c,a,b) VALUES(3,4,5);d)INSERT INTO R(b,c) VALUES(3,4); infant formulas typically contain protective antibodies for infants. true or false? was it good that Pope Urban II called a crusade According to Erikson, which of the following best describes an individual who is in the state of ego integrity?O The person has developed a healthy sense of identity and goals in life.O The person has the ability to self-regulate and take initiative in his or her own actions.O The person has come to terms with his or her life, for better or worse.O The person has developed a sense of trust with his or her primary care provider. given a sequence x subscript 1 comma... comma x subscript m and k states in hmm, what is the runtime of the viterbi decoding algorithm? o(mk2) o(km) o(mk2) o(m2) The map shows the eastern Mediterranean Sea.A map of the Middle East. Letter A is located south of the Mediterranean Sea, next to the Nile River. Letter B is located to the east of the Mediterranean Sea near the Jordan River. Letter C is located between the Tigris and Euphrates rivers. Letter D is located on an island in the Mediterranean Sea, not far from letter B.Judaism was founded in a region called Israel, which is shown on the map at letter Find two sets of parametric equations for the rectangular equation y = 32-2 1.2 t and y= 2. ytand = 0/8 pts 499 Details Let y = 4x? Round your answers to four decimals if necessary. (a) Find the change in y, Ay when a I 7 and Ar = 0.2 y = (b) Find the differential dy when I = 7 and da = 0.2 Questi i need the whole problem done plus the steps to it please, im stressed and its due soon Steam Workshop Downloader