Algorithms - An unambiguous set of steps, which when performed correctly by a processor, will result in a process being carried out in a finite time.
In other words, it is a specific set step-by-step instructions that are used to accomplish a task.
An example of an algorithm would be making a cup of coffee.
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.
Q1) 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 order of each instruction in an algorithm enable it to correctly describe the solution. If those steps were to be executed in any order, it wouldn't be able to properly complete the task.
- Precise intructions. If the method wasn't clear, then making a cup of coffee wouldn't be possible.
Q2) Define Algorithms for the following processes:
Posting a letter-
1. Get a paper to write on
2. Think of what you want to write in the letter.
3. Write the date on the top of the page. (preferrably to the top right)
4. Write the recipent's name and address below the date.
5. Leave some space below the recipent's address.
6. Start writing the letter with a proper greeting such as "Dear" or "To whom it may concern"
7. Write an opening paragraph. Asking "how are you?" if it's a casual letter. If it's a business letter, go straight to the point that you want to discuss with the recipent.
8. Write the body of the letter.
9. Write the conclusion of the letter.
10. Write the closing of the letter like "yours sincerely" or "love from" then write your name and signature.
11. Write your adress in the back of the envelope and write the recipent's address in the middle of the front of the envelope.
12. Go to the post shop, then purchase a stamp.
13. Stick the stamp on the envelope.
14. Give the letter to the person working in the post office, or drop it inside the postbox.
Making toast-
1. Get the toaster and plug it in the powerpoint.
2. Go to the fridge and get the bread that you want to toast from the fridge.
3. Put the bread inside the toaster and turn on the toaster.
4. After the bread has popped out of the toaster, or if your toaster makes a "ding" sound, take the bread out and put it on a plate.
Calling a friend on the phone-
1. Think of which friend you want to call.
2. Find your friend's phone number from the phone book.
3. Dial your friend's number on the phone.
4. If your friend's family member answers the phone, ask politely for him/her.
5. Talk to your friend.
Friday, August 14, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment