ALGORITHM
Prepared by: Mr. John Patrick S. Paulino
ICT S112: FUNDAMENTALS OF COMPUTING 1
LEARNING OBJECTIVES
1. Discuss the properties of algorithm.
2. Explain the process of flowcharting.
3. Follow the process of creating a correct and
error-free flowchart.
4. Create a correct and error-free IPO, flowchart,
and pseudocode.
ICT S112: FUNDAMENTALS OF COMPUTING 2
WHAT IS AN ALGORITHM?
A step-wise solution to a specific problem.
A finite set of steps defining the solution of a particular
problem.
A recipe for solving problems.
Algorithms are a fundamental part of computing.
An algorithm can be expressed in English like language,
called pseudocode, in a programming language or in the
form of flowchart.
ICT S112: FUNDAMENTALS OF COMPUTING 3
ALGORITHM VS. PROGRAM
A program is an implementation of an
algorithm to be run on a specific computer
and operating system. An algorithm is more
abstract – it does not deal with machine
specific details – think of it as a method to
solve a problem.
ICT S112: FUNDAMENTALS OF COMPUTING 4
PROPERTIES OF AN ALGORITHM
Finiteness - there is an exact number of steps to be taken
and has an end.
Absence of Ambiguity - means that every instruction is
precisely described and clearly specified.
Sequence of Execution - instructions are performed from
top to bottom.
Input and Output - defined the unknowns of the problem is
specified and with the expected outcome.
ICT S112: FUNDAMENTALS OF COMPUTING 5
PROPERTIES OF AN ALGORITHM
Effectiveness - the solution prescribed is guaranteed to give
a correct answer and that the specified process is faithfully
carried out.
Scope Definition - applies to a specific problem or class of
problem.
ICT S112: FUNDAMENTALS OF COMPUTING 6
ICT S112: FUNDAMENTALS OF COMPUTING 7
IPO MODEL
INPUT PROCESS OUTPUT
INPUT – A requirement from the environment
PROCESS – A computation based on the requirement
OUTPUT – A provision for the environment
ICT S112: FUNDAMENTALS OF COMPUTING 8
METHODS OF SPECIFYING AN
ALGORITHM
Flowchart - a traditional graphical tool with standardized
symbols. Show the sequence of steps in an algorithm.
Pseudocode - specifies the steps of algorithm using
essentially natural language of superimposed control
structure.
ICT S112: FUNDAMENTALS OF COMPUTING 9
ICT S112: FUNDAMENTALS OF COMPUTING 10
ICT S112: FUNDAMENTALS OF COMPUTING 11
ICT S112: FUNDAMENTALS OF COMPUTING 12
ICT S112: FUNDAMENTALS OF COMPUTING 13
FLOWCHARTING GUIDELINES
1. The flowchart should flow from top to bottom.
2. If the chart becomes complex, utilize connecting blocks.
3. Avoid intersecting flow lines.
4. Use meaningful description in the symbol.
ICT S112: FUNDAMENTALS OF COMPUTING 14
DIFFERENCE BETWEEN ALGORITHM AND
PSEUDOCODE
An algorithm is a well-defined sequence of steps that
provides a solution for a given problem, while a pseudocode
is one of the methods that can be used to represent an
algorithm.
While algorithms can be written in natural language,
pseudocode is written in a format that is closely related to
high level programming language structures.
ICT S112: FUNDAMENTALS OF COMPUTING 15
DIFFERENCE BETWEEN ALGORITHM AND
PSEUDOCODE
But pseudocode does not use specific programming
language syntax and therefore could be understood by
programmers who are familiar with different programming
languages.
Additionally, transforming an algorithm presented in
pseudocode to programming code could be much easier
than converting an algorithm written in natural language.
ICT S112: FUNDAMENTALS OF COMPUTING 16
SUMMARY
Algorithms are a fundamental part of
computing in creating correct and error-free IPO,
Flowchart, and Pseudocode. Flowcharts determine
the process of a program/application from top to
bottom.
ICT S112: FUNDAMENTALS OF COMPUTING 17