Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms and Algorithmic Thinking. Instructions on making a Jam Sandwich.

Similar presentations


Presentation on theme: "Algorithms and Algorithmic Thinking. Instructions on making a Jam Sandwich."— Presentation transcript:

1 Algorithms and Algorithmic Thinking

2

3 Instructions on making a Jam Sandwich

4

5 Origins of Algorithms Dinsdag 6 augustus 2002 is de Nederlandse informaticus Edsger Wybe Dijkstra overleden. Hij werd over de hele wereld beroemd door zijn ideeën over gestructureerd programmeren.

6

7 “Peeling Potatoes for a Family Supper” We observe the cook doing this “He gets the potato basket from the cellar, gets the pan from the cupboard, peels the potatoes returns the basket to the cellar” Sequence

8

9 “Go to the other side of the road” “Go to Hell” Meaningful Instructions Effective

10

11 Meaningful Instructions Unambiguous A wedding journalist reported that the four bridesmaids wore the same dress.

12

13

14

15 Instructions “He gets the potato basket from the cellar, gets the pan from the cupboard, peels the potatoes returns the basket to the cellar” get the potato basket from the cellar, get the pan from the cupboard, peel the potatoes return the basket to the cellar Sequence Correct Order

16

17 Jordan does something different get the potato basket from the cellar, get the pan from the cupboard, IF clothes are light colored THEN put on an apron peel the potatoes return the basket to the cellar IF some condition THEN some action Selection

18

19 “peel the potatoes” Halting

20

21 “peel the potatoes” IF number of peeled potatoes is not sufficient THEN peel a potato

22

23 “peel the potatoes” WHILE the number of potatoes is insufficient DO peel a potato get the potato basket from the cellar, get the pan from the cupboard, IF clothes are light colored THEN put on an apron WHILE the number of potatoes is insufficient DO peel a potato return the basket to the cellar WHILE condition is true DO an action Iteration

24

25 “peel the potatoes” WHILE condition is true DO an action Instruction Blocks WHILE condition is true DO action1 action2 action3

26

27 Algorithms – a definition Sequence of Instructions (ordered) Instructions are Effective and Unambigous Sequence must Halt in a finite time On halting, the sequence must have a Result Instructions may be Simple Actions Selections Iterations action IF condition THEN action WHILE condition is true DO action

28

29 DanielBobGrantAnneCarolNathanSue Sequential Search Algorithm - Example

30

31 DanielBobGrantAnneCarolNathanSue Sequential Search Algorithm - Example

32

33 Daniel BobNathan AnneCarolGrantSue Binary Search (Tree Representation) L LL H HH

34

35 Password Cracker Passwords created with lower case only a…z

36

37 Computational Thinking

38

39

40

41 Pseudo-code and Code there is a list of numbers get the length of the list set the value of sum to zero while the end of the list has not been reached get the next value in the list add this to the sum display the sum int numArray[2]; int len; int index; int sum; numArray[0] = 3; numArray[1] = 4; length = numArray.length; index = 0; sum = 0; while(index <= length) { sum = sum + numArray[index]; index = index + 1; } printf(“Sum is %d”, sum);

42

43 get the potato basket from the cellar, get the pan from the cupboard, peel the potatoes return the basket to the cellar

44

45 I Have A Lovely Bunch Of Coconuts

46

47 x = 5 Y = 3 Temp = X X = Y Y = Temp

48

49

50

51 Music Algorithmic?

52


Download ppt "Algorithms and Algorithmic Thinking. Instructions on making a Jam Sandwich."

Similar presentations


Ads by Google