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 a pseudo-language, is made up of variables and instructions. Variables store information and describe how to access computer memory. The instructions make it possible 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 unsolved 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 the two values are known. The problem is solved by a series of instructions of the power type

The interactions with the user are also described by the algorithm thanks to 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 beginning with a Beginning and ending with a " closing the process” marked End).

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 Input or Write, existing in most computer languages, when the operation of these functions 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 return

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.

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:

Transfer of information:

Subprogram call:

Linear sequence:

If…else:

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

Do…while loop:

More complete list in English:

EN
FR
FR
EN
ES
Exit mobile version