This document discusses algorithms and provides examples to illustrate them. An algorithm is a step-by-step method for solving a problem that includes an input, process, and output. Food recipes and different methods for getting to school are given as examples of algorithms. Flowcharts can also represent algorithms graphically and are useful for developing and explaining complex problem-solving methods. The document emphasizes that there are often multiple algorithms that can solve the same problem in different ways.
2. A method that includes all the steps of
solving a problem in order is known as an
algorithm.
3. • The process of problem solving has an input, an outcome and a
process.
Problem solving
Input -Things to be included to solve the
problem.
Process - guidelines to be followed to solve
the problem.
Output -The result you get after solving the
problem.
4. Algorithms :Example 1
• A food recipe is a step-by-step
procedure like a list of instructions-
to complete a task.
• A food recipe therefore is like an
algorithm.in this analogy it can be
compared to the software in a
system. The hardware is the oven
and other cooking utensils.
• The input is the ingredients and the
output is the soup.
Food Recipe
5. Algorithms :Example2
‘’Going to school’’
1.Walk to bus
stop
2.Wait for bus
3.Get on bus
4.Ride bus to
school
5.Get off bus
at school bus
stop.
6.Walk to
class.
1.Get in car.
2.Be driven
along city road.
3.Turn left into
town lane.
4.Car stops in
drop off zone.
5.Get out of
car
6.Walk to class.
*Designing algorithms is about designing solutions to solve problems.
If you were to design an algorithm to solve the problem of ‘’getting to
school’’ you would be able to solve this problem in several different
ways (see left).
*Different algorithms can solve the same problem-but in different
ways.
*Algorithms that solve the same problem may differ in length,
efficiency and cost.
*In computer programming there are many different ways-
algorithms-of solving a problem and completing a task.
A computer program can be viewed as an elaborate algorithm.
6. Flowcharts
*Developing a flowchart helps to formalize the algorithm-
and allows more choices.
Complexity and variables- crucial as you move past the
simple problems can often be shown best as a flowchart.
*Flowcharts can help you to think logically about problems
by working through each step.
*Flowcharts can help you explain your work to others- and
they can follow your thinking(very useful when trying to
‘fault find’ errors/mistakes’ in your algorithms).
A flowchart is a graphical representation of the algorithmic steps.