• Aucun résultat trouvé

Episode 01 Algorithms

N/A
N/A
Protected

Academic year: 2022

Partager "Episode 01 Algorithms"

Copied!
30
0
0

Texte intégral

(1)

Episode 01 Algorithms

European section, season 1

European section, season 1 Episode 01 Algorithms

(2)

What’s an algorithm Example 1 Example 2

Plan

1 What’s an algorithm

2 Example 1

3 Example 2

European section, season 1 Episode 01 Algorithms

(3)

What’s an algorithm

An algorithm is a list of well-defined instructions for completing a task.

European section, season 1 Episode 01 Algorithms

(4)

What’s an algorithm Example 1 Example 2

What’s an algorithm

An algorithm is a list of well-defined instructions for completing a task. It’s generally made of three parts :

European section, season 1 Episode 01 Algorithms

(5)

What’s an algorithm

An algorithm is a list of well-defined instructions for completing a task. It’s generally made of three parts :

1 the input, where data are entered ;

European section, season 1 Episode 01 Algorithms

(6)

What’s an algorithm Example 1 Example 2

What’s an algorithm

An algorithm is a list of well-defined instructions for completing a task. It’s generally made of three parts :

1 the input, where data are entered ;

2 the process itself made of well-defined operations ;

European section, season 1 Episode 01 Algorithms

(7)

What’s an algorithm

An algorithm is a list of well-defined instructions for completing a task. It’s generally made of three parts :

1 the input, where data are entered ;

2 the process itself made of well-defined operations ;

3 the output, where the result of the algorithm is displayed.

European section, season 1 Episode 01 Algorithms

(8)

What’s an algorithm Example 1 Example 2

Input

The input can be

European section, season 1 Episode 01 Algorithms

(9)

Input

The input can be numbers ;

European section, season 1 Episode 01 Algorithms

(10)

What’s an algorithm Example 1 Example 2

Input

The input can be numbers ; words ;

European section, season 1 Episode 01 Algorithms

(11)

Input

The input can be numbers ; words ;

geometrical objects ;

European section, season 1 Episode 01 Algorithms

(12)

What’s an algorithm Example 1 Example 2

Input

The input can be numbers ; words ;

geometrical objects ; almost anything.

European section, season 1 Episode 01 Algorithms

(13)

Input

The input can be numbers ; words ;

geometrical objects ; almost anything.

Variables are often used in algorithms, notably to store and manipulate the input. They are named with a letter or a sequence of letters and digits, such as : A, n, input , input 1, . . .

European section, season 1 Episode 01 Algorithms

(14)

What’s an algorithm Example 1 Example 2

Input

The input can be numbers ; words ;

geometrical objects ; almost anything.

Variables are often used in algorithms, notably to store and manipulate the input. They are named with a letter or a sequence of letters and digits, such as : A, n, input , input 1, . . .

European section, season 1 Episode 01 Algorithms

(15)

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

European section, season 1 Episode 01 Algorithms

(16)

What’s an algorithm Example 1 Example 2

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

Assign value 10 to variable A : 10A.

European section, season 1 Episode 01 Algorithms

(17)

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

Assign value 10 to variable A : 10A.

Add 1 to the value of n : n+1→n.

European section, season 1 Episode 01 Algorithms

(18)

What’s an algorithm Example 1 Example 2

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

Assign value 10 to variable A : 10A.

Add 1 to the value of n : n+1→n.

Add the variables x and y and store the result in x : x +yx.

European section, season 1 Episode 01 Algorithms

(19)

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

Assign value 10 to variable A : 10A.

Add 1 to the value of n : n+1→n.

Add the variables x and y and store the result in x : x +yx.

European section, season 1 Episode 01 Algorithms

(20)

What’s an algorithm Example 1 Example 2

Changing the value of a variable

One of the key instructions in algorithms is changing the value of a variable. This can be done in different ways, using English or a symbolic language.

Assign value 10 to variable A : 10A.

Add 1 to the value of n : n+1→n.

Add the variables x and y and store the result in x : x +yx.

We will use the notation A→10, as the use of=can be misleading.

European section, season 1 Episode 01 Algorithms

(21)

Plan

1 What’s an algorithm

2 Example 1

3 Example 2

European section, season 1 Episode 01 Algorithms

(22)

What’s an algorithm Example 1 Example 2

Example 1

begin 1→A ; A+1→B ; 3→A ;

European section, season 1 Episode 01 Algorithms

(23)

Example 1

begin 1→A ; A+1→B ; 3→A ;

Values of the variables :

A B

European section, season 1 Episode 01 Algorithms

(24)

What’s an algorithm Example 1 Example 2

Example 1

begin 1→A ; A+1→B ; 3→A ;

Values of the variables :

A B

Step #1 1

European section, season 1 Episode 01 Algorithms

(25)

Example 1

begin 1→A ; A+1→B ; 3→A ;

Values of the variables :

A B

Step #1 1 Step #2 1 2

European section, season 1 Episode 01 Algorithms

(26)

What’s an algorithm Example 1 Example 2

Example 1

begin 1→A ; A+1→B ; 3→A ;

Values of the variables :

A B

Step #1 1 Step #2 1 2 Step #3 3 2

European section, season 1 Episode 01 Algorithms

(27)

Example 1

begin 1→A ; A+1→B ; 3→A ;

Values of the variables :

A B

Step #1 1 Step #2 1 2 Step #3 3 2

European section, season 1 Episode 01 Algorithms

(28)

What’s an algorithm Example 1 Example 2

Plan

1 What’s an algorithm

2 Example 1

3 Example 2

European section, season 1 Episode 01 Algorithms

(29)

Example 2

begin

Input : C, a whole number ; if C =1745 then

Output : “Correct code.” ; else

Output : “Wrong code. Try again.” ;

European section, season 1 Episode 01 Algorithms

(30)

What’s an algorithm Example 1 Example 2

Example 2

begin

Input : C, a whole number ; if C =1745 then

Output : “Correct code.” ; else

Output : “Wrong code. Try again.” ;

European section, season 1 Episode 01 Algorithms

Références

Documents relatifs

Write an algorithm that builds the multipliation table for a number less than

Therefore, sensory attenuation seems to be only one aspect of a phenomenon which has implications for several cognitive processes (Smallwood & Schooler, 2015). For example, a

In the 1965 edition of the ASHRAE Guide and Data Book the winter table included 62 Canadian stations, which was approximately.. the number requested

Using Bishop’s approximation (Bishop, 1995) of the objective function when a restricted type of noise is added to the input of a parametric function, we derive the higher order terms

Inverse Problems for Ordinary Dierential Equations: Dynamical Solutions.. Fundamentals of the method of

Particularly, the surface of the fire appears to be important to explain the variance of the maximal upper layer temperature, the outside temperature appears to be the most

These results show that randomized comparison-based algorithms are not so bad, in spite of their limitations in terms of convergence rate: (i) they are optimal in the robust

Norm-based semantics to deontic logic typically come in an unconstrained and constrained version, where the unconstrained version comes with a proof system, and the constraints