0% found this document useful (0 votes)
4 views

What is an Algorithm

An algorithm is a set of logical steps used to solve a problem, characterized by having a starting point, clear steps, and a finite number of steps. The problem-solving process involves defining the problem, proposing solutions, determining the best solution, developing the algorithm, representing it as pseudocode or a flowchart, and testing the solution. Examples illustrate how to create algorithms from problem statements using an IPOS chart to identify inputs, processing, outputs, and storage.

Uploaded by

ethanugas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

What is an Algorithm

An algorithm is a set of logical steps used to solve a problem, characterized by having a starting point, clear steps, and a finite number of steps. The problem-solving process involves defining the problem, proposing solutions, determining the best solution, developing the algorithm, representing it as pseudocode or a flowchart, and testing the solution. Examples illustrate how to create algorithms from problem statements using an IPOS chart to identify inputs, processing, outputs, and storage.

Uploaded by

ethanugas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

What is an Algorithm?

A set of logical, well defined steps that is used to solve a problem.

Characteristics of an algorithm
 Must have a starting point.
 Variables are used to store values that are used in processes.
 Must have a finite number of steps.
 Each of its steps and their inputs and outputs should be clear and must only
have one meaning.
 Each step must flow into the next step.
 After the last step the algorithm must come to an end.

Problem Solving Process


1. Define the problem – Start with a clear description of the problem (Problem
Statement). Use an IPOS Chart to break the problem down.

2. Propose and Evaluate Solutions – Consider other solutions to the problem.


Evaluate each solution to see if they make sense.

3. Determine the best solution – From your evaluation of each solution determine
which one is the best.

4. Develop the algorithm – Take your best solution and create a set of logical, well
defined steps written in everyday language.

5. Represent the algorithm as pseudocode or a flowchart.

6. Test and validate the solution. A Trace Table is used to check the correctness of
the flowchart or pseudocode using carefully selected test data.
How to create an algorithm from a problem statement?
Using the steps in the Problem Solving Process section we can take a problem
statement and create an algorithm.
Example:
Problem Statement: Given the length and breadth of a rectangle, find and show
the area.
Determine the Inputs, Processing, Outputs and Storage from the problem
statement using the keywords.
Inputs: length, breadth
Processing: Area = length x breadth
Outputs: Area
Storage: none
Once we have identified all the IPOS we put them in an IPOS Chart.
Input Processing Output Storage
length Area = length x breadth Area none
breadth

Using the Characteristics of an Algorithm section as a guide we create the


algorithm as follows.
Start
Output: “Enter length and breadth”
Input: length, breadth
Area = length x breadth
Output: “Area of rectangle is: “, Area
End
Example:
Problem Statement: Given a sum of money in dollars, calculate and show how
many 25 cents and 10 cents are there in that sum of money.
Determine the Inputs, Processing, Outputs and Storage from the problem
statement using the keywords. In this example there are two processing
statements. The first one is used to find how many 25 cents are there in the sum of
money and the second finds how much 10 cents are there in the sum of money.
Note!
Inputs to IPOS Charts and algorithms are variables. Data stored in a variable can be
changed, we can only store one value at a time and the variable can only store one
type of data. They can be in the form of numbers or words. In this example 25Cents,
10Cents and sumOfMoney are all number variables. We can give any number value
to sumOfMoney before we find how many 10 cents and 25 cents are in that sum.

Inputs: sumOfMoney
Processing: 25Cents = sumOfMoney x 4
10Cents = sumOfMoney x 10
Outputs: 25Cents, 10Cents
Storage: none
Once we have identified all the IPOS we put them in an IPOS Chart.
Input Processing Output Storage
sumOfMoney 25Cents = sumOfMoney x 4 25Cents none
10Cents = sumOfMoney x 10 10Cents
Using the Characteristics of an Algorithm section as a guide we create the
algorithm as follows.
Start
Output: “Enter a sum of money in dollars”
Input: sumOfMoney
25Cents = sumOfMoney x 4
10Cents = sumOfMoney x 10
Output: “The number of 25 cents are: “, 25Cents
Output: “The number of 10 cents are: “, 10Cents
End

You might also like