Pseudocode

Pseudocode is a clear, compact, unambiguous description of an algorithm or computer program aimed to communicate this to other people. It is more structured and precise than English, but more high-level than code, with a focus on readability.

Writing pseudocode

Before presenting the algorithm, make sure the reader understands the aim of the program, e.g. give a concise description of expected input and output. Then aim to follow these principles:

Basic constructs

Generally, aim to be concise. So include essential details such as the initialisation of variables and return and/or print statements, but leave out unnecessary or obvious details, such as type declarations if this is clear from the context, the implementation of data structures (unless you are explaining the inner workings of a data structure), and a sorting routine (unless you are explaining the inner workings of it).

Advanced constructs