Algorithms are composed of three basic structures;..... Sequence, Selection and Repitition. Solving a problem often involves makng a decision between two or more options. In an algorithm this process of making a decision is called selection.
- Moving through a set of traffic lights.
You stop at the lights and observe the colour of the light to determine whether to drive or not.
2.Deciding whether to take an umbrella to school.
You will look at the whether and decide if its cold enough or humid enough to need an imbrella in case of a storm.
3.Giving a student an A, B or C on their test.
You look at how many questions the student has gotten right and how many they have gotten wrong and decide whether their marks deserve an A, B or C.
Often an algorithm will often require you to repreat a task in order to solve a problem; when this is done in an algorithm the structure is called repetition.
Describe in plain english an algorithm for;
1.Adding the correct amount of cordial to water to make a drink.
You add a bit of cordial, test it, then add more until you reach the desired taste.
2.Filling a bucket with water.
You will add a little bit of water at a time until youve reached the limit or desired amount.
3.Blowing up a balloon.
You will blow up the balloon then stop and look at the size and blow more until youve reached the desired size.
0 comments:
Post a Comment