Hi, in this second section about computer sciences and its foundations, we will talk about algorithmic. This section will be divided into 4 sequences. The first sequence will constitute an introduction to tasks, and how a complex problem can be divided into small parts. Then, a sequence of variables. What is a variable? What can we do with it? Then, a sequence about elementary instructions, I mean that an algorithm is made of small parts, but what are these parts exactly? And finally, we will talk about algorithmic culture, so we have a more general review of what an algorithm actually is, and what constitutes algorithmic.
So let's start with tasks. To explain tasks, I'll start with a small algorithm, a simple problem. There is a chart with marks, the marks of a number of students which are decimal values. The question is, according to this chart, how many students obtained a passing mark? Knowing that the chart can be large. In that particular case, it's quite easy because we only have to look at the marks higher than 10, here they are coloured in red on the slide, we count them with our finger, and then we notice that there are indeed 6 marks above 10, so six students did get a passing mark. In that example, we saw that we could do it manually.
But it's more interesting to do it with a computer, so what can the computer do? It can do many things: it can perform calculations, it can eventually put it into variables, in some memory space, it can execute tasks successively if needed, it can run tests, and it can make loops. We will review all this in other sequences. But actually, what you have to keep in mind, is that it can perform simple and unitary tasks, which means it can successively execute very simple commands.
Let's get back to our example: we have a very, very large chart, with millions and millions of boxes, how do we do it? We don't want to colour the boxes red and count them manually. If there was only one box, it would be easy because we just have to look at it. If the mark is higher than 10, it means the answer is one, but if it's not, it's 0. Let's imagine that we can reach the solution when there are n-1 boxes. In that case, regarding the n-1 boxes, there are S students that got a passing mark, so then I only have to look at the umpteenth, if it's higher than 10, that means an S+1 student got a passing mark, and if the mark is lower than 10, there are only S students that got a passing mark. That's dividing a problem into simple and unitary tasks.
So we are going to turn that into an algorithm and write in a pseudo-code. That's not programming, that's still algorithmic. A program has entries. The entry is the integer first, which is the size of the chart which I require to be strictly positive, and then the chart itself which is made up of a certain number of boxes, decimals, or whatever. I chose the boxes to be from t[0] to t [n-1], it depends on the language, but here is my pseudo-code, I chose it to be from 0 to n-1 and at the other end, I have the S integer which is the same as that on the previous slide telling the number of students, value numbers that are higher than 10.
Then there's the algorithmic so the S value is initialised to 0. Then there is the I variable which I will use to browse the chart, so I am going to browse every box in the chart successively. And for each box, I look at the value: if it is higher than 10, I add 1 to the S variable and if it is lower than 10, above all, I do nothing. Once I am done