GCSE Computing Revision – What an Algorithm is, How to write it and How to use it to plan a program

A simple flowchart for troubleshooting a broke...

Image via Wikipedia

What is an Algorithm?

  • According to WordNet and Wolfram Alpha it’s “a precise rule (or set of rules) specifying how to solve some problem”
  • An algorithm is a series of instructions on how to do something
  • It is not the same thing as a flowchart. (A flowchart is a way of writing an algorithm)

Good Algorithms

  • For an algorithm to be good enough for a computer to follow it must be:
  • Unambiguous – There must be only one way to interpret each instruction
  • To the right level of detail – Not too vague, not too specific
  • Correct – Free from errors

Planning a Program with an Algorithm

  • “Weeks of programming can save you hours of planning” – Unknown

    Rounded Rectangle: Start or Finish, Rectangle: Process, Diamond: Decision, Paralelogram: Input or Output, Rounded Arrowhead: Access stored data

    The flowchart symbols you need to know for GCSE Computing. Others do exist.

  • This programming saying means that you have to plan your program before you start to write it or it’ll take forever because you won’t have a clear idea of what you actually intend to do
  • Although it’s boring and seems like a waste of time you do need to be able to write and read algorithms as flowcharts and pseudocode for the GCSE Computing exam and coursework
  • You can see how it’s supposed to help – it lets you get the hang of what you want your program to do and in what order you want it do it
  • If your plan is detailed enough, the coding stage should be as simple as converting your algorithm to code
  • Although in my opinion this is rarely the case due to the inevitable unforseen errors. (Sorry about the oxymoron there!)
  • Writing an algorithm isn’t the only part of planning a program – for GCSE Computing coursework you also have to do other stuff but this post is concentrating on what an algorithm is and how to write one for the exam.

Flowcharts

  • A flowchart is a way of writing an algorithm (like the one above courtesy of Wikipedia)
  • The steps are in the correct order with arrows to show where to go after completing a step
  • Different symbols are used to show different sorts of instructions
  • The colour of the symbols doesn’t matter
  • For a decision block (diamond) you need an arrow for ‘Yes’ and an arrow for ‘No’
  • The main ‘blocks’ you need to know are listed in the picture on the upper right. (I made this myself: Sorry about the bad drawing skills)

Pseudo Code

  • Pseudo Code (or pseudocode as I like to call it when I’m not being assessed) is another way of writing an algorithm
  • It is NOT a programming language
  • It is a shorthand language that uses English to describe an algorithm
  • It is written like a really simple programming language
  • “Display” is used for output and “Get” is used for input
  • It is quite easy to write because it is meant to be easy to read
  • There are no syntax rules because it’s so ‘wordy’
  • Here is an example
  • The pseudocode programming software below does not actually exist: I made the logo as a joke because PSEUDOCODE IS NOT A PROGRAMMING LANGUAGE. I know that’s not at all hard to remember but writing it in capitals and assuming the reader will instantly forget it makes me feel like a real revision guide writer :)

The 'Logo' for Micrasoft Visual Pseudocode 2010 Express Edition

Advertisements

About Matt

I like writing, filmmaking, programming and gaming, and prefer creating media to consuming it. On the topic of consumption, I'm also a big fan of eating.
This entry was posted in GCSE Computing Revision, Programming and tagged , , , , , , , , , . Bookmark the permalink.

5 Responses to GCSE Computing Revision – What an Algorithm is, How to write it and How to use it to plan a program

  1. Thank you, this helped a lot with my revision!

  2. Pingback: GCSE Computing Revision – Types of Testing and Types of Test Data | Matt's blog

  3. Pingback: GCSE Graphics Revision – Safety | Matt's blog

  4. Pingback: English Exam Preparation | Matt's blog

  5. I never thought of it that way, well put!

Enter comment:

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s