Here are some definitions:
unambiguous- clearly defined meaning, no doublt or misunderstanding
processor- the part of a computer that does most of the data processing
finite- has an end
algorithm- an umambiguous set of steps which when performed correctly by a processor, will result in a process being carried out in a finte time
To make an algorithm correct the sequence of steps must be in the correct order. Algorithms are composed of three basic structures, Sequence, Selection and Repition. Solving a problem often involves making a decision between two or more options. In an algorithm this process of making a decision is called selection.
Here are some examples of algorithms:
Calling a friend on the phone.
1) pick up the phone
2) enter their phone number in the correct sequence using the buttons with the numbers on them
3) press the 'talk' button
4) raise the phone to your ear
5) wait until your friend answers
6) if parent or older sibling answers, politely ask for friend
7) have the desired conversation with your friend
8) lower the phone from your ear
9) press the 'call end' button
10) put phone back in the holder
Making toast.
1) get bread out of cupboard
2) get toaster out of cupboard
3) plug the end of the cable into a power socket
4) turn on the power point
5) get 1 slice of bread out of the packet
6) slide bread into one of the openings in the top of the toaster
7) select the heat setting on the toaster
8) press down handle to start heating bred
9) wait for toast to pop up
10) get breadboard, knife and margarine out
11) put toast on breadboard
12) spread margarine on toast using knife
13) cut toast into half
14) if too hot to eat leave to cool for a few minutes
No comments:
Post a Comment