Pseudo-language and flowchart

Pseudo-language and flowchart

Before writing a algorithm in a programming language, it is first described in a higher level language called the pseudo-language. It is a limited set of instructions to describe how the algorithm works in such a way that anyone can understand how it works. The pseudo-language is usually written in English, but nothing prevents it from being written in another language.

Writing an algorithm

Any programming language, including pseudo-language, is made up of variables and instructions. Variables store information and describe how to access computer memory. Instructions are used to modify the state of these variables.

An algorithm is therefore composed of a series of instructions which, starting from a description in memory of an unresolved problem, give the modifications of the memory making it possible to arrive at a description in memory of the solved problem.

For example, if we want to calculate x ^ 2 ^ k. x and k are two variables, the problem is described as soon as we know the two values. The problem is solved by a series of instructions of the power type

Interactions with the user are also described by the algorithm through input and output instructions. Here the inputs are the values of x and k, the output is the power value.

The algorithm is written as follows: the header (name of the algorithm), the variables (inputs and outputs with the type), the body (the sequence of instructions starting with a Beginning and ending with a " closing of the process ”noted End).

pseudo-language pseudo-code flowchart algorithm

It is important to add comments preceded by "//" in order to clarify the intentions of the algorithm. It is possible to use explicit function names such as Enter or Write, existing in most computer languages, when the operation of the latter is known.

Most of the time the body of the algorithm is based on the following diagram: what we ask the user, what we calculate, what we restore

Writing a flowchart

The role of a flowchart (or algorigram) is to represent an algorithm in a more functional and easy to read way. The flowchart represents the body of the algorithm using a graph whose vertices can be of different types, as well as the links. For information, a flowchart is part of the “flowchart” category.

pseudo-language pseudo-code flowchart algorithm

It is not necessary to note Decision and Calculation, these indications are only present to show the role of the vertices in this flowchart. Here is a sample of the correspondences between pseudo-language and flowchart.

Pseudo-language and flowchart

Conditional test:

pseudo-language pseudo-code flowchart conditional test algorithm

Information transfer:

pseudo-language pseudo-code flowchart algorithm

Subprogram call:

pseudo-language pseudo-code flowchart algorithm

Linear sequence:

pseudo-language pseudo-code flowchart algorithm

If ... else:

pseudo-language pseudo-code flowchart algorithm

While Loop (the for contains downstream and in-loop processing):

pseudo-language pseudo-code flowchart algorithm

Do ... while loop:

pseudo-language pseudo-code flowchart algorithm

More complete list in English:

pseudo-language pseudo-code flowchart algorithm