bartekpiglo
bartekpiglo
16.12.2021 • 
Mathematics

There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A
Step 1: All students stand.
Step 2: A randomly selected student writes his or her height on a card and is seated.
Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until no students remain standing.
Step 5: The sum on the card is divided by 32. The result is given to the teacher.

Algorithm B
Step 1: All students stand.
Step 2: Each student is given a card. Each student writes his or her height on the card.
Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one studentâs card; the other student is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until one student remains standing.
Step 5: The sum on the last studentâs card is divided by 32. The result is given to the teacher.

Which of the following statements is true?

a. Algorithm A always calculates the correct average, but Algorithm B does not.
b. Algorithm B always calculates the correct average, but Algorithm A does not.
c. Both Algorithm A and Algorithm B always calculate the correct average.
d. Neither Algorithm A nor Algorithm B calculates the correct average.

Solved
Show answers

Ask an AI advisor a question