成人快手

Algorithms - EdexcelPseudo-code

Algorithms are step-by-step plans for solving problems. Algorithms can be designed using pseudo-code, flowcharts, written descriptions and program code. There are also some standard algorithms for searching and sorting.

Part of Computer SciencePrinciples of computer science

Pseudo-code

Most are developed using . These languages have specific that must be used so that the program will run properly.

is not a programming language. Instead, it is a simple way of describing a set of programming in a manner that resembles a programming language. Pseudo-code has its own syntax, some of which is very similar to many actual programming languages. Any designed using pseudo-code will not run unless they are converted into an actual programming language.

This simple pseudo-code algorithm asks a user to input what their favourite subject is:

WHILE answer <> 'computer science' DO
                    聽聽聽聽聽SEND 'What is your favourite subject?' TO 
                         DISPLAY
                    聽聽聽聽聽RECEIVE answer FROM (STRING) KEYBOARD
                    聽聽聽聽聽IF answer = 'computer science' THEN
                    聽聽聽聽聽聽聽聽聽聽SEND 'Good choice!' TO DISPLAY
                    聽聽聽聽聽ELSE
                    聽聽聽聽聽聽聽聽聽聽SEND 'Really? ' TO DISPLAY
                    聽聽聽聽聽END IF
                    END WHILE

Advantages and disadvantages of pseudo-code

Designing an algorithm in pseudo-code has advantages because:

  • it can be quickly and easily converted into an actual programming language as it is similar to a programming language
  • it is fairly easy to understand, even for non-programmers
  • it does not matter if there are errors in the syntax - it is usually still obvious what is intended
  • changes to the design can be incorporated quite easily

Pseudo-code also has its disadvantages:

  • It can be hard to see how a program flows. For example, where does following one path as opposed to another take the program?
  • It can be time consuming to produce.

Pseudo-code covers many areas of programming and there are different variants. The specific pseudo-code syntax for the Edexcel GCSE Computer Science course can be found at the end of the .