Algorithms and IPO diagrams
Ways to represent an algorithm:
Flowcharts
Pseudocode
Python programming language
What is an algorithm?
It is a set of steps, procedures or actions
that allow us to achieve a result or solve
a problem.
Ways to represent an algorithm
Ways to represent an algorithm
Natural language: is the language spoken and / or
written by human beings for general
communication purposes.
Example: Given two numbers obtain the sum of them:
1. I ask for the two numbers: number1 and number2.
2. Then I add the two number.
3. I show the result I got from the sum.
Ways to represent an algorithm
Pseudocode: is the description of an algorithm that resembles a
programming language, but with some natural language
conventions. In pseudocode, the algorithm steps are numbered so
that one action is performed per row. Example: Given two numbers
obtain the sum of them.
1. Algorithm SumTwoNumbers (start)
2. Write "give me the first number"
3. Read A (input)
4. Write "give me the second number"
5. Read B (input)
6. Result 🡨 A+B (allocation Sum A plus B)
7. Escribir "La suma es: ",Resultado (output)
8. End Algorithm (ends)
Ways to represent an algorithm
Flowchart: it is the graphic
representation of an
algorithm; use symbols or
blocks connected with
arrows to indicate the
sequence of instructions.
Ways to represent an algorithm
Programming language: it is
a language that can be used to
control the behavior of a
computer; each language
establishes its syntax rules for
creating the programs that
will give the instructions to
the computer.
IPO Diagram
When designing an algorithm, it is important to previously
identify:
Inputs Processes Outputs
IPO Diagrams
Inputs Identify the variables that are required to solve the
algorithm, the data that needs to be requested.
Processes Are the actions required to find the solution to the
problem posed.
Outputs It is the result of the solution to the problem.
IPO Diagrams
Example 1: Prepare a strawberry smoothie.
Inputs Processes Outputs
Blender Blend the
Strawberries Strawberry
strawberries,
Milk smoothie
milk and
Sugar sugar
Example:
A student wants to
know the area of a
triangle from the
base and height
IPO Diagrams
Calculate the area of a triangle.
Inputs Processes Outputs
b (base) A=(b*h)/2
h (height) A (area)
Flowchart:
Pseudocode:
Python Programming Language: