Professional Documents
Culture Documents
TO Programming: Algorithm Development With Flowchart
TO Programming: Algorithm Development With Flowchart
TO
PROGRAMMING
Algorithm Development with Flowchart
ALGORITHM
Simply put, anDEVELOPMENT PHASE
algorithm is a set of instructions that describe a method or
a plan for solving a problem.
Example of an ambiguous statement is: “stay away from the bank”, the
bank have different meanings e.g. bank of river, or bank where money is
kept, thus the statement “stay away from bank” is ambiguous and such
instruction should be made explicit enough so that the computer can
execute it.
ALGORITHM
Algorithm:
a precisely specified procedure for
solving a problem or
a step-by-step method to solve a
problem or complete a task
IMPORTANT PROPERTIES OF ALGORITHMS
Unambiguous
Precise
Efficient
Can be measured in terms of
Time
Space
Time tends to be more important i.e. tradeoff
ALGORITHM CONTD
A good algorithm should have the following attributes:
Definiteness; it should be well defined, that is every
steps should be definite
Finiteness; it should terminate after finite number of
times
Input; it may or may not have inputs
Output; it must produce some result
Efficiency ; an efficient algorithm should execute faster,
and take less memory space
CORRECTNESS OF ALGORITHM (START 02/06)
This are the principles to understand in order to develop a good software system.
Thus we have programming methodology which deals with how an algorithm is developed.
In this course we want to learn programming language in line with program methodologies that make you a good
programmer.
TYPES OF PROGRAMMING
METHODOLOGY
We have two types of programming methodologies,
they are:
1. Top down design
2. Object oriented design (OOD)
Top-down approach uses divide and conquer technique where the problem
is broken down into sub problems, such that each sub problems or modules
can be solved (i.e. conquered) independently of the other. This methodology
is used by procedural languages like C. Each sub-problem forms a
procedure.
An object oriented design is used majorly by object oriented programming
languages like Java, and C++. This breaks problems down into objects.
PROGRAMMING
METHODOLOGY
Each of these methodologies can be expressed in any of these forms:
step-by-step “cookbook” approach for carrying out the procedure (pseudo code);
and an objective set of criteria for determining whether the results of the
procedure are of acceptable quality e.g. computational cost, time and space
complexity etc.
DEVELOPING AN ALGORITHM
As said earlier an
algorithm can be
represented as either a
flowchart or a pseudo code.
FLOWCHART
Flowchart
A flow chart is a pictorial representation
of an algorithm in which symbols are
used to show the various operations and
decisions to be followed in solving a
problem.
In summary steps that must be followed.
FLOWCHART SYMBOLS
Flowchart symbol Explanation
Terminal symbol; indicate start/stop/End
The diamond indicates a decision. It has one entrance and two and only two
exits. One exit is the action when the resultants is True and the other exit is the
action when the resultant is False
Connector : this is used for the purpose of junction. Some rimes the flow chart
can’t be completed on a single page and it require 2 or more pages, these
connector symbols is used.
Rectangle with lines down each side indicates the process of modules. They have
one entrance and only one exit.
This is called predefined process..
FLOWCHART
This flowchart shows the steps that
may be taken in solving the lamp
problem. Start
End
FLOWCHART STEPS
Start from the first stage of problem solving process
Draw the input symbol and indicates if the inputs (this step is optional)---- input is
based on the identified input in problem solving process
Based on processing requirement you may need the following symbols:
Processing symbol for computation
Decision symbol for making decisions
Indicate the end symbol and use the necessary arrows to show how each symbol
moves to the end.
GROUP WORK
Design a flowchart for the followings:
admission process
hall registration process
student registration process
daily activities of Babcock student
LAB II
Draw the flowchart for examples 1 and 2.
The volume of a cylinder is given by
V = π r2h
Write the pseudo code and draw the flowchart
Area = πr2
write the pseudo code and draw the flowchart.
LAB II ASSIGNMENT
Following the problem solving process find the sum, product, difference,
and quotient of any two numbers.