It is an unambiguous set of steps, at which wehen performed correctly by a proffesor will result in a process being carried out in a finite time.
Example- Algorithm when explaining to someone how to make a cup of coffee-
- Boil the water
- Place coffee in the cup
- place sugar in the cup
- add the boiling water
- add milk
- And stir
The most important part of an algorithm is the way the steps are pleaced in order. It is very important that this is done the right way as the rest of the sequence is reliant to it. For example if steps 2 and 6 were swapped there will be a certain variable that will limit the steps to be done, or the end product will not be the same. in this example, if stirring and placing the coffee in the sup were swapped, and individual will then be stirring an empty cup. Steps aklso should have a finite number of steps, so that the algorithm will end when the goal is reached. They should be short, simple and straight to the point.
Here are some examples-
POSTING A LETTER
- Write the letter to whom it may concern.
- Fold the sheet of paper/letter to the appropriate size that it should fit into the envelope
- Place the letter in the envelope. Then write the address of where it should be sent to on the back of the envelope.
- Seal the envelope.
- Find your nearest Post office, and buy the appropriate postage stamp for your letter.
- Stick/Paste the stamp on the top right hand corner of the envelope.
- Place letter in the postbox.
- Place the appropriate amount of toast in the toaster. (Amount may depend on your choice, or how much the toaster can fit.
- Adjust toaster setting according to the usersneed and choice of how the bread is cooked.
- Push the lever on the side of the toast down.
- When toasts "pop up". Put the desired spread on the toast accroding to your taste.
- Eat and enjoy !
- Search the phonebook for the desired friend to call.
- Press green button showing a "phone" image on the left hand side of the phone.
- Make sure the phone is ringing. And wait.
- When friend picks up, start your conversation.
- When finished press the red button on the right hand side of the phone.
No comments:
Post a Comment