Wednesday, July 21, 2010

ariadne is too cool.

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"?)

2. Define Algorithms for the following processes.

Making toast and consuming.
1. buy bread.
2. buy toaster
3. buy topping
4.place bread in toaster
5. choose setting for idea toasting degree
6. press the toaster button thing down.
7. wait for the bread to toast.
8. take bread out of toaster
9. place toast on plate
10. dress your toast
11. place toast in hand
12. open mouth
13. place toast in open mouth
14. close mouth
15. chew
16 .repeat steps 12-15 until all consumed.
17. clean up.

Calling a friend on the phone.
1. gain friend
2.


No comments:

Post a Comment