Algo & Flow Chart
Algo & Flow Chart
Algorithms:
Definitions:
It should be simple.
It may accept zero or more inputs.
It should be precise with no ambiguity.
It should have finite number of steps.
It should produce atleast one output.
Disadvantages of an Algorithm:
(i) Developing algorithms for large and complex problems is time consuming and difficult to
understand.
(ii) Understanding complex logic is tedious.
Flowchart:
2
Definitions:
A flowchart depicts pictorially the sequence in which instructions are carried out in
an algorithm.
A flowchart is a schematic representation of an algorithm or a stepwise process,
showing the steps of boxes of various kinds and their order by connecting these with
arrows.
Flowcharts are used not only as aids in developing algorithms but also to document
algorithms.
Flowcharts are used in designing or documenting a process or program.
Flowchart symbols:
(or procedure).
2) -Input/Output: This is used to accept the variable for processing and display the
processed results.
page.
3
6) -Looping: Is used for repeating steps several numbers of times until the given
condition is satisfied.
8) -Data Flow: It indicates the flow of data from one geometrical signal to another.
1. Efficient Communication: since its represented in pictorial form a flowchart seems to be the
better way of communicating the logic to the programmers or any common man.
2. Efficient Analysis: With the help of a flowchart problem can be analyzed effectively.
3. Proper Documentation: flowchart plays an important role in understanding the logic of
complicated and lengthy problems. Hence it is very much required to document the
flowcharts along with algorithms.
4. Easy and efficient coding: by looking at the flowchart writing programs is a straight forward
approach.
5. Program Debugging: flowchart helps in debugging process i.e., to identify the logical errors
in the program.
6. Program Maintenance: Maintaining the software or set of programs becomes easy.
Drawbacks of flowchart:
(i) Complex logic: For complicated logic the flowchart becomes complex and clumsy.
4
(ii) Alterations and modifications: if there is a change in the logic, the flowchart has to
be completely rewritten and requires lot of time.
(iii) Reproduction: in the case of any problem, reproduction of flowchart becomes
problem since the flowchart symbols cannot be typed.
Step 4: [Terminate]
Stop.
Else
If false Display “the number is positive”.
Step 3: [Terminate]
Stop.
Step 5: [Terminate].
Stop.
Step 1: [ initialization]
small = big = temp
Step 2: [Input the variables].
Read temp.
Step 2: [Initialization]
Factorial =1.
Step 5: [Terminate]
Stop.
Step 2: [Initialization]
Sum=0
Step 5: [Terminate]
Stop.
7
Step 2: [Comparision]
Check condition (a>b) and (a>c) then
display a is greatest.
else check if (b>c) then
display b is greatest.
else display c is greatest.
Step 3: [Terminate]
Stop.