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.
1. 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"?)
Two properties are:
- the listing of steps
- the order in which the steps are in.
An algorithm is correct simply if the order of the steps get the result you want in the end.
Hint: If you swapped step 6 and step 2- there is nothing really wrong with it, it just wouldn't make sense stirring boiling water and if you place coffee at the end, while your sugar, boiling water and milk are already added, then when you add coffee, if not stirred it wouldn't taste very "normal"(of course some people like it this way..maybe)!
2. Define Algorithms for the following processes.
POSTING A LETTER
1. Get letter
2. Place it in an envelope
3. Go to the post office and get a stamp
4. Place stamp on top right corner of envelope with letter in it.
5. Find the appropriate post box (local mailing, national or international)
6. Open the handle of the box and slip the envelope into the slot of the post office box.
MAKING TOAST
1. Get bread out with butter, jam etc... ( if wanted) as well as a plate and a butter knife.
2. Place how many slices wanted onto plate
3. Place 2 slices at a time in toaster, adjust settings.
4. Wait a few minutes
5. Once toast pops up be careful that it is not hot and place it on plate.
6. Apply spread of your choice
7. Eat Up
Calling a friend on the phone
1. If you dont remember their number get your phone book or ask someone else.
2. Dial phone number into phone.
3. Wait...listen to the dial tone...
4. Whoever picks up ( if its not your friend, ask to speak to your friend, if it is your friend, start talking about whatever you called them about.
5. [Another situation: If your friend is not at home, leave a message or call back]
6. Gossip away!
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment