Algorithm:
The word Algorithm means “a process or set of rules to be followed in
calculations or other problem-solving operations”. Therefore Algorithm refers
to a set of rules/instructions that step-by-step define how a work is to be
executed upon in order to get the expected results.
Clear and Unambiguous: Algorithm should be clear and
unambiguous. Each of its steps should be clear in all aspects and
must lead to only one meaning.
Well-Defined Inputs: If an algorithm says to take inputs, it should
be well-defined inputs.
Well-Defined Outputs: The algorithm must clearly define what
output will be yielded and it should be well-defined as well.
Finite-ness: The algorithm must be finite, i.e. it should not end up
in an infinite loops or similar.
Feasible: The algorithm must be simple, generic and practical,
such that it can be executed upon with the available resources. It
must not contain some future technology, or anything.
Language Independent: The Algorithm designed must be
language-independent, i.e. it must be just plain instructions that can
be implemented in any language, and yet the output will be same,
as expected.
Problem − Design an algorithm to add two numbers and display the result.
Step 1 − START
Step 2 − declare three integers a, b & c
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to c
Step 6 − print c
Step 7 − STOP
Algorithms tell the programmers how to code the program. Alternatively, the
algorithm can be written as −
Step 1 − START ADD
Step 2 − get values of a & b
Step 3 − c ← a + b
Step 4 − display c
Step 5 − STOP
Flowchart:
Flowchart is a diagrammatic representation of sequence of logical steps of a
program. Flowcharts use simple geometric shapes to depict processes and arrows
to show relationships and process/data flow.
Flowchart Symbols
Here is a chart for some of the common symbols used in drawing flowcharts.
Symbol Symbol Name Purpose
Start/Stop Used at the beginning and end of the algorithm to
show start and end of the program.
Process Indicates processes like mathematical operations.
Input/ Output Used for denoting program inputs and outputs.
Decision Stands for decision statements in a program,
where answer is usually Yes or No.
Arrow Shows relationships between different shapes.
On-page Connector Connects two or more parts of a flowchart, which
are on the same page.
Off-page Connector Connects two parts of a flowchart which are spread
over different pages.
Guidelines for Developing Flowcharts
These are some points to keep in mind while developing a flowchart −
Flowchart can have only one start and one stop symbol
On-page connectors are referenced using numbers
Off-page connectors are referenced using alphabets
General flow of processes is top to bottom or left to right
Arrows should not cross each other
Example Flowcharts
Here is the flowchart for going to the market to purchase a pen.
Here is a flowchart to calculate the average of two numbers.