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

DSAA Week5 Algorithms

This document provides an overview of algorithms including: - Definitions of an algorithm as a list of instructions that specifies a precise step-by-step process to solve a problem in a finite number of steps. - Properties of algorithms such as being finite, unambiguous, having defined input/output, and being effective. - Methods for specifying algorithms including pseudocode, flowcharts, and their basic symbols. - Examples of flowcharts and exercises to create flowcharts for simple calculation problems. The document teaches the key concepts and components of algorithms and how to represent them using flowcharts and pseudocode. It provides guidance on properly constructing flowcharts and examples of basic flowchart symbols.

Uploaded by

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

DSAA Week5 Algorithms

This document provides an overview of algorithms including: - Definitions of an algorithm as a list of instructions that specifies a precise step-by-step process to solve a problem in a finite number of steps. - Properties of algorithms such as being finite, unambiguous, having defined input/output, and being effective. - Methods for specifying algorithms including pseudocode, flowcharts, and their basic symbols. - Examples of flowcharts and exercises to create flowcharts for simple calculation problems. The document teaches the key concepts and components of algorithms and how to represent them using flowcharts and pseudocode. It provides guidance on properly constructing flowcharts and examples of basic flowchart symbols.

Uploaded by

jade Production
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Week 5:

Algorithms
Prepared by:
Ms. Angilyn J. Leoncio
Algorithm

Definition

It is a list of instructions specifying a A finite set of an instruction that


precise description of a step by step specifies a sequence of operation to be
process that terminates after a finite carried out in order to solve a specific
number of steps for solving an problem.
algorithm problem producing the
correct answer in the end. An unambiguous procedure specifying
a finite number of steps to be taken.
It is a recipe for solving problems.
Properties of Algorithm

Finiteness - there is an exact Input and Output - defined the unknowns


number of steps to be taken and has of the problem is specified and with the
an end. expected outcome.

Absence of Ambiguity - means Effectiveness - the solution prescribed is


that every instruction is precisely guaranteed to give a correct answer and that
described and clearly specified. the specified process is faithfully carried out.

Sequence of Execution - Scope Definition - applies to a specific


instructions are performed from top problem or class of problem.
to bottom.
Methods of Specifying Algorithm

Pseudocode - specifies the steps


 
Flowchart - a traditional graphical
 

of algorithm using essentially tool with standardized symbols.


natural language of superimposed Show the sequence of steps in an
control structure. algorithm.
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


Methods of Specifying Algorithm

START START

System Flowchart
 
Program Flowchart
 

Gather time cards Enter


from departments Employee #
 
A flowchart is a formalized  
A graphical representation of a
Input # of
graphic representation of a logic Gather employee computer program in relation to its work days
files from HR
sequence, work or manufacturing sequence of functions
Input basic
Compute salary (w/ salary
process, organization chart, or deductions)

similar formalized structure. 


Total = basic salary
- deductions
Distribute payslips

Send net salaries to Print total


in payslip
bank

END END
Basic Flowcharting Symbols
SYMBOL NAME DESCRIPTION

Defines the starting and


TERMINAL ending point of a flowchart.

The preparation or
INITIALIZATION initialization of memory space
for data processing.

The inputting of data for


INPUT/OUTPUT processing, and printing out
of processed data.

Manipulation of
data(assignments and
PROCESS mathematical computations)
Basic Flowcharting Symbols
SYMBOL NAME DESCRIPTION

Defines logical sequence of


FLOW LINES the program. Its points to
the next symbol to be
performed
Connects to the flowchart to
ON-PAGE CONNECTOR avoid spaghetti connection
on the same page

Connects the flowchart on


OFF-PAGE CONNECTOR different page to avoid
spaghetti connection

Process conditions using


DECISION relational operators. Used
for trapping and filtering
data.
Branching And Control Of Flow

Flow Lines On-page Symbol

Terminator Symbol Off-page Symbol

Decision Symbol
Input and Output

Data I/O Symbol Multi-document Symbol

Document Symbol Display Symbol

Manual Input Symbol


Process/Operation Symbols

Process Symbol Pre-defined Process

Preparation Symbol Delay

Alternate Process Symbol Manual Operation


File And Information Symbols

Magnetic Disk
Stored Data Symbol (Database)

Direct Access Storage


Exercises:
 
Direction: In a 1 whole sheet of paper, write a flowchart for the following problems.

1. Write a program that calculates the sum of two input numbers and display the result.

2. Write a program to calculate the area of a circle and display the result. Use the formula: A=πr 2 where Pi is
approximately equal to 3.1416.

3. Write a program that computes the average of three input quizzes, and then display the result.

4. Write a program that converts the input Fahrenheit degree into its Celsius degree equivalent. Use the formula: C=
(5/9)*F-32.

5. Create a program to compute the volume of a sphere. Use the formula: V= (4/3)* πr 3 where is pi equal to 3.1416
approximately. The r3 is the radius. Display result.

6. Write a program that converts the input Celsius degree into its equivalent Fahrenheit degree. Use the formula: F=
(9/5) * C+32.
More questions?

ASK MS. LEONCIO

Email add: [email protected]

Messenger: fb/angie.leoncio.5

You might also like