• Aucun résultat trouvé

Season 1 • Episode 01 • Algorithms

N/A
N/A
Protected

Academic year: 2022

Partager "Season 1 • Episode 01 • Algorithms"

Copied!
3
0
0

Texte intégral

(1)

Season 1Episode 01Algorithms

0

Algorithms

Season 1

Episode 01 Time frame 1 period

Objectives :

Read an algorithm.

Followan algorithmwith paper and pen.

Materials :

Slideshow explainingthe main onepts.

Task sheet.

Answersheet.

1 – Short lecture about algorithm 10 mins

Usinga slideshow, the teaher explainsthe main onepts about algorithmsandgivesan

example.

2 – Group work 45 mins

The lass is divided in four groups. Eah group has to arry out a few tasks involving

algorithms. Eah task is awarded a ertain mark to make up a nal mark at the end of

(2)

Algorithms

Season 1

Episode 01 Document Task sheet

Algorithm # 1

Begin

Input :

A A + 2 → A

;

Output :

A

end

1. Apply this algorithmtothe following inputs.

Input

0 5 − 2 10

Output

2. What seems tobethe purpose of this algorithm?

Algorithm # 2

Begin

Input :

x

;

If

x > 0

then

Output :

x

else

Output :

− x

end_if

end

1. Apply this algorithmtothe following inputs.

Input

2 − 2 5 − 5 − 8 − 9

Output

2. What seems tobethe purpose of this algorithm?

Algorithm # 3

Begin

Input :

( x, y ) 10x + y → u

;

100 u → v

;

100 v → w

;

u + v + w → s

;

Output :

s

Apply this algorithmtothe following inputs.

Input

(5 , 3) (2 , 1) (6 , 7)

Output

(3)

Season 1Episode 01Algorithms

2

Algorithm # 4

Begin

Input :

(A, B) A + B → A

;

A − B → B

;

A − B → A

;

Output :

( A, B )

end

1. Apply this algorithmtothe following inputs.

Input

(2 , 3) (5451 , 721) ( √ 5 , π )

Output

2. What seems tobethe purpose of this algorithm?

Algorithm # 5

Begin

Input :

u 1 →

Step ;

Output : Step 1: ,

u

Repeat9 times

Step +1

Step ;

If

u

is even

then

u 2 → u

else

3 × u + 1 → u

end_if

Output : Step, Step , : ,

u

end_repeat

end

Applythisalgorithmtothefollowinginputs.

Input

1 6

Output1

Output2

Output3

Output4

Output5

Output6

Output7

Output8

Output9

Output10

Extras

1. In a shop, during sale time, there is a 10% disount if the amount of the purhase

is greater than or equal to

500

pounds. Write an aglorithm that omputes atual

amount paid by the ustomer.

Begin

end

2. Write analgorithmthat builds the multipliationtable for anumberless than 10.

Begin

Références

Documents relatifs

For each algorithm, the table considers the number of messages it uses to implement the write operation (line 1), the read operation (line 2), the number of control bits carried

Table 3 shows the number of examined nodes (i.e., for which g- and h-values are computed) for the proposed exact task assignment algorithm with the proposed heuristic function....

Episode 16 – Points and line equations. European section,

Any line has an equation of this form, and in fact many as it’s always possible to apply a. coefficient to the

A regular n-gon can be constructed with compass and straightedge if n is the product of a power of 2 and any number of distinct Fermat primes. Gauss conjectured that this condition

For each algorithm, the table considers the number of messages it uses to implement the write operation (line 1), the read operation (line 2), the number of control bits carried

We begin our exposition with the Goemans–Williamson algorithm for the MaxCut problem (i.e., the problem of computing an edge cut with the maximum possible number of edges in a

Current goal: write an algorithm for computing Betti tables of toric surfaces that exploits. I known facts about