Wednesday, July 20, 2011

Algorithm?

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"?)
The algorithym contains simple easy to understand steps which are straight to the point and they have to be in a sequentiall order.  What makes an algorythm correct is the fact that there are numbers beside the steps which enable the person to know the correct order in which the steps should be taken.




2. Define Algorithms for the following processes.

POSTING A LETTER1. Write or obtain a letter

2. Fold it appropriately

3. Find the correct size envelope

4. Write the address on the cover cover of the envelope

5. Seal the folded letter inside the envelope

6. Travel to the post office

7. Buy the appropriate postage stamp

8. Paste the stamp on the top right corner of the envelope

9. Place the letter in the postbox
MAKING TOAST
1. Place two pieces of toast in the toaster

2. Adjust toaster to the appropriate settings

3. Push the leaver down and submerge the slices

4. Wait for the toast to pop up

5. Put your desired spread on the toast

6. Eat your toast!

CALLING A FRIEND ON THE PHONE
1. Search the phone book

2. Locate the number of the friend

3. Dial the number on the phone

4. Wait till he/she picks up!

5. Press the 'end' button at the end of the conversation




No comments:

Post a Comment