Transcript for:
Introduction à l'algorithmique et ses applications

Hello everyone and welcome to this first video in a series of algorithmic lessons. Algorithmics is the discipline that is interested in algorithms. An algorithm is a series of elementary operations known under the name of instructions, which when executed correctly leads to a given result. Before getting into the technical details, let's take the following example: Imagine that one evening your friend called you and you were asked for the recipe to prepare the spaghetti, and as you are so nice, you have actually assisted him by phone until he prepares his recipe. So you ask him to take a pan, fill it with water, put it on the heat and when the water gets boiling, you ask him to put his spaghetti on, wait five minutes and then take it out. Without knowing it you have just created an algorithm and your friend has just executed it. So you may not be aware of it, but you are still running algorithms in your daily life; when you shop at the market, when you show a tourist a way or when you run a cooking recipe , you are always creating you are running algorithms without knowing it. Technically speaking now, when a computer problem arises, the solution often consists in creating a program to solve it and to create this program, we have recourse to one or more programming languages. There are dozens and dozens of programming languages ​​out there and just memorizing all of their names is considered an achievement in itself. As a programmer, you can choose any such or such programming language, such as C, C ++, Java, Python, Ruby, Javascript or others. The choice of language often depends on the domain to which the problem to be treated belongs, such as the domain of the web, mobile, networks, security etc ... and the theme can also have an influence on the language to be adopted, as by example statistics, artificial intelligence, 3D games and so on. Of course each programming language has its own peculiarities, but the most important is that it has its own syntax. So we can say that there are as many syntaxes as there are languages, although there are languages which are inspired by each other and whose syntax remains relatively close. However the common point between programming languages ​​and the logic of programming itself, this logic is called the algorithm. Therefore, the first discipline that a future programmer must learn is algorithmics, in other words, he must understand how to divide a large problem into a series of smaller operations, themselves divided into instructions. An algorithm is independent of any programming language. It is not a code that will be submitted to the computer to execute it, but rather it is a sketch or a detailed diagram of the operations that must be undertaken in order to successfully complete the solution of the problem posed, and when the algorithm is finished and judged adequate, then at that moment we can translate we have a real program using a programming language so that it is executed by the machine . So an algorithm is not necessarily written on a computer, but it can be written on paper as a draft and a future program. There is no rigorous method or syntax to represent an algorithm, so we can write it as we see fit. However, two methods are standardized, namely; the writing in the form of a flowchart and the pseudo code. Imagine that we want to write an algorithm that calculates the result of the division of two numbers A and B. We can propose the following flowchart. Every flowchart has a beginning and an end, at the end an algorithm is nothing more than a finite set of instructions, however long it is, however complex it is, the number of operations is always finite . So, the first operation that must be done is that the computer asks the user to enter the value of A and then we retrieve this value, after the computer asks the user to enter the value of B which we in turn recover. The operation is only feasible if B is different from zero, then we have to do a test. If B is equal to zero, that is to say if the answer is yes, in this case the operation is invalid and the computer displays for example a message on the screen to tell us that the operation cannot be made. Otherwise, that means if B is not zero, in this case we will predict C which will receive the result of the division of A by B and finally we will display this result on the screen, and in all cases the The program will end, either we take the right path or the left path, but what is certain is that we can never take both paths simultaneously. With a pseudo code, the algorithm will look like this. It is about a set of lines which describe the solution to the problem posed which are connected from top to bottom. But I'm not going to explain these lines just yet because you have to start small. However, pseudo-code is preferred to the flowchart because it presents the solution better regardless of its complexity and in addition, given its structure, it looks like a real programming language, which means that it is easier to be translated into a program. So for the rest of this course we will discover the basics of algorithmics, namely, variables and their types, operators, conditional and iterative structures, strings, arrays and functions and procedures, and the more important is that we will learn to write functional and optimized algorithms. Thank you for your attention and see you next video.