Efficiency of Algorithms (AQA GCSE Computer Science)

Exam Questions

6 mins3 questions
11 mark

Identify one option that describes what is meant by ‘algorithm efficiency’ in programming.

  • How much memory an algorithm takes to store the data

  • How many times the user needs to input data during the algorithm execution

  • How much time it takes to complete an algorithm

  • How well an algorithm can handle large amounts of data without producing errors

Did this page help you?

12 marks

A programmer needs to choose between two algorithms, Algorithm A and Algorithm B, to solve a problem.

Algorithm A takes 500 milliseconds to process 1,000 items, while Algorithm B takes 300 milliseconds to process the same number of items. However, Algorithm A uses less memory than Algorithm B.

Explain one situation where the programmer might prefer Algorithm A over Algorithm B, even though it is slower.

Did this page help you?

1a1 mark

Consider the following pseudocode, which asks the user to input 5 numbers and stores them in a list:

DECLARE list AS []
a ← USERINPUT
APPEND(a, list)
b ← USERINPUT
APPEND(b, list)
c ← USERINPUT
APPEND(c, list)
d ← USERINPUT
APPEND(d, list)
e ← USERINPUT
APPEND(e, list)

Identify one inefficiency in this code

1b2 marks

Write the pseudocode to make it more efficient using a loop.

Did this page help you?