Data Structures and Algorithmn
Data Structures and Algorithmn
AND
FLOWCHARTIN
Lesson 2 – Data Structures and
G
Algorithm
MR. ROWELL L.
MARQUINA
IT Instructor, PUP
WHAT IS
AN
ALGORITHM
?
What is an
Algorithm?
An algorithm refers to a series of well-
defined instructions on how to accomplish
a task or solve a specific problem.
Giving directions on how to get to
somebody’s house is an algorithm.
The steps on how to change a light bulb
is an algorithm.
The steps to compute the for average
is also an algorithm.
IMAGE SOURCES:
https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/ANSI_logo.svg/1200px-ANSI_logo.svg.png
https://1000logos.net/wp-content/uploads/2020/09/ISO-Logo.png
Flowchart
Symbols
IMAGE SOURCES:
https://uploads-ssl.webflow.com/6184b461a39ff13bfb8c0556/61de99e8171cc6468145551d_flowchart-symbols-800.png
Flowchart
Symbols
NAME OF SYMBOL SYMBOL FUNCTION
Indicates the beginning and end of
Terminal Symbol
the flowchart.
Its shows the process’ direction or the
Flowline Symbol
next steps in the process.
It shows the process or operations to
Process Symbol
be carried out by the program
input The program get an input from the user and store its
birthyear value in the variable birthyear.
display
The program displays the value of age on the
age
screen.
display
The program displays the instruction “Enter
“Enter Weight in
Weight in
Kilogram:”
Kilogram: ” on the screen.
input The program get an input from the user and store its
kilo value in the variable kilogram.
pound = kilo * 2.2 The program computes for the value of pound using
the formula pound = kilo * 2.2.
display
pound The program displays the value of pound on the
screen.
The program is
END
terminated.
SAMPLE FLOWCHART
3:
COMPUTING FOR AREA:
Create a flowchart for a program that will
require the user to input the length and width
of a rectangle. The program will compute for
the area of the rectangle using the inputted
length and with and display its results on the
screen.
STAR The program is
T initiated.
length, width, area The variables length, width, and area were
introduced to the program.
input The program get an input from the user and store its
length value in
the variable length.
input The program get an input from the user and store its
width value in the variable width.
area = length * width The program computes for the value of area using
the formula area = length*width.
display
The program displays the value of area on the
area
screen.
input The program get an input from the user and store its
num1 value in
the variable num1.
display The program displays the instruction “Enter the
“Enter the Second Second
Number: ” N u m b er: ” on the screen.
input The program get an input from the user and store its
value in the variable num2.
num2
A The program will be continued on the next
slide.
A
The program is
continued.
display The program displays the instruction
“Enter the Third “Enter the Third Number: ” on the
Number: ” screen.
input The program get an input from the user and store its
value in the variable num3.
num3
display The program displays the instruction
“Enter the Fourth “Enter the Fourth Number: ” on the
Number: ” screen.
input The program get an input from the user and store its
value in the variable num4.
num4
The program computes for the value of sum using
sum = num1 + num2
the formula sum = a + b.
display
The program displays the value of sum on the
sum
screen.
display
The program displays the value of square on the
square
screen.
input The program get an input from the user and store its
num1 value in
the variable num1.
display The program displays the instruction “Enter the
“Enter the Second Second
Number: ” N u m b er: ” on the screen.
input The program get an input from the user and store its
value in the variable num2.
num2
A The program will be continued on the next
slide.
A
The program is
continued.
display The program displays the instruction
“Enter the Third “Enter the Third Number: ” on the
Number: ” screen.
input The program get an input from the user and store its
value in the variable num3.
num3
display The program displays the instruction
“Enter the Fourth “Enter the Fourth Number: ” on the
Number: ” screen.
input The program get an input from the user and store its
value in the variable num4.
num4
The program computes for the value of cube using
cube = num1 * num1 * num1
the formula cube = num1 * num1 * num1.
twentyp = num3 * 0.20 The program computes for the value of twentyp
using the formula twentyp = num3 * 0.20.
The program computes for the value of times100
times100 = num4 * 100
using the formula times100 = num4 * 100.
display
The program displays the value of half on the
half
screen.
display The program displays the value of twentyp on the
twentyp screen.
Professional Lecturer,
Polytechnic University of the
Philippines