Explaining Algorithms (CIE IGCSE Computer Science)

Revision Note

Test Yourself
Dan Turnes

Expertise

Computer Science

Explaining Algorithms

  • Algorithms can be written using flowcharts, pseudocode or high-level programming language code such as Python
  • The purpose of an algorithm is to achieve some goal. It isn’t always initially clear what the goal may be. By following the algorithm instructions, the purpose can become clear

Exam Tip

  • Comments in an algorithm or program usually describe why something has been done or provide useful information to the reader. Each line of code should otherwise be self-explanatory
  • The purpose of the algorithm below is to add ten user-entered numbers together and output the total. The processes are: 
    • initializing three variables (Count, Number, Total)
    • inputting a user number
    • adding to two variables (Total, Count) 
    • repeating nine more times
    • outputting the final Total value

Count ← 1

Number ← 0

Total ← 0

REPEAT

INPUT Number

Total ←  Total + Number

Count ← Count + 1

UNTIL Count > 10

 

OUTPUT Total

Worked example

The Pseudocode Algorithm shown has been written by a teacher to enter marks for the students in her class and then to apply some simple processing. 

Count ← 0

REPEAT 

INPUT Score[Count] 

IF Score[Count] >= 70 

  THEN 

Grade[Count] ← "A" 

ELSE 

IF Score[Count] >= 60 

  THEN 

Grade[Count] ← "B" 

ELSE 

IF Score[Count] >= 50 

  THEN 

Grade[Count] ← "C" 

ELSE 

IF Score[Count] >= 40 

  THEN 

Grade[Count] ← "D" 

ELSE 

IF Score[Count] >= 30 

  THEN 

Grade[Count] ← "E" 

ELSE 

Grade[Count] ← "F" 

ENDIF 

ENDIF 

ENDIF 

ENDIF 

ENDIF 

Count ← Count + 1 

UNTIL Count = 30 

Describe what happens in this algorithm. 

[3]

Any 3 of:

  • Inputted marks are stored in the array Score[] [1]

  • Marks are then checked against a range of boundaries [1]

  • A matching grade is assigned to each mark that has been input [1]

  • The grade is then stored in the array Grade[] [1]

  • At the same index as the inputted mark [1]

  • The algorithm finishes after 30 marks have been input [1]

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Dan Turnes

Author: Dan Turnes

Dan graduated from the University of York with a BEng in Computer Science and has been a teacher and tutor of GCSE and A-Level Computer Science in the Yorkshire area for over six years. His goals are to engage students in the science of learning and to enable them to enjoy the experience. Dan's continued practice has brought him to SME to create high quality resources and support students to achieve their potential in Computer Science.