Algorithms

EasyMediumHard
1234567891011121314151617181920212223242526272829303132333435363738
Question 22
Medium

Here is the pseudo-code for an algorithm designed to count how many recorded temperatures are over 30 degrees.

SET count TO 0
FOR EACH temp FROM temperatures DO
    IF (temp > 30) THEN
        SET count TO count + 1
    END IF
END FOREACH
SEND "Hot days: " & count TO DISPLAY

Here is a small dataset sorted in descending order. It is stored in the array called temperatures:

28, 25, 22, 19, 15, 12

Describe one inefficiency when executing this algorithm with this dataset.

[2]

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms