What is an Algorithm?
An unambiguous set
of steps, which when performed correctly by a processor, will result in a process being carried out in a finite time.
For example if you were to explain to someone how
to make a cup of coffee you would be defining an algorithm;
1.
boil the water,
2.
place coffee in the cup,
3.
place sugar in the cup,
4.
add the boiling water,
5.
add milk,
6.
stir.
1. Examine the algorithm above. What
two properties of the algorithm enable it to correctly describe the solution to
the problem of making a cup of coffee? What is it that makes an algorithm
correct?(Hint: what would happen if you
swapped step "6" and step "2"?)
_________________________________________
Repition. _________________________________
Incorrect results____________________________
_________________________________________
2. Define Algorithms for the
following processes.
Making
toast
·
Get the toast.
·
Put the toast in the toaster.
·
Get the toppings.
·
Put the toppings on the toast.
·
Eat it.
Posting
a letter.
·
Get a pen and a paper
·
Write the letter.
·
Get an envelop.
·
Put the letter in the envelop.
·
Mail it.
Calling
a friend on the phone
·
Dial the number on the mobile phone.
·
Press the call button.
·
And it rings.