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

Algorithm and Flowchart

Uploaded by

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

Algorithm and Flowchart

Uploaded by

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

Unit-1

General Problem Solving Concept and


Imperative Languages
Algorithm
An algorithm is a description of a procedure which
terminates with a result. Algorithm is a step-by-step method
of solving a problem.
• Properties of an Algorithm:
• 1)Finiteness: - An algorithm terminates after a finite
numbers of steps.
• 2)Definiteness: - Each step in algorithm is unambiguous.
This means that the action specified by the step cannot
be interpreted (explain the meaning of) in multiple ways &
can be performed without any confusion.
Algorithm
• 3)Input: - An algorithm accepts zero or more inputs
• 4)Output:- An algorithm should produce at least one
output.
• 5) Effectiveness: - It consists of basic instructions that are
realizable. This means that the instructions can be
performed by using the given inputs in a finite amount of
time.
Algorithm

Writing an algorithm-
• An algorithm can be written in English, like sentences and
using mathematical formulas. Sometimes algorithm
written in English like language is Pseudo code.
Pseudocode

It is a high-level description of an algorithm that uses


natural language and simple programming constructs to
convey the logic of an algorithm. Pseudocodes are like a
special language software developers use to plan an
algorithm before writing the code.
In simple terms, it is considered a way or medium to
communicate algorithms to other people (or non-
programmers) and to document algorithms for future
reference.
Pseudocode
Parameter Algorithm Pseudocode

An end-to-end description of an
A step-by-step procedure for
algorithm in formally English (or in
Definition performing the task or solving the
natural language) to convey the logic
problem.
of an algorithm.

Formality Highly formal and very precise. Less formal and more flexible.

Difficult to understand for non- Easy to read; even non-programmers


Readability
programmers can understand it too.
It can be directly executed in a
Executibility It can’t be directly executed.
programming language.
It may be tied to any specific Not tied to any specific platform and
Portability
programming language. programming language.
Structured, but not specific to any
Structure Unstructured
programming language.
Use for the actual implementation of Used as a planning tool before writing
Use Cases
code. any complex code.
Algorithm to find whether a number even or odd:
• Step1: Begin • Step1: START
• Step2: Take a number • Step2: Read num
• Step3: if the number is • Step3: if(num%2=0) then
divisible by2 then print that print num is even
number is even otherwise
number is odd otherwise number is odd
• Step4: End • Step4: STOP
( natural language)
(using pseudo code)
Flowcharts

The pictorial representation of algorithm is called


flowchart.
Uses of flow chart:
1 : flow chart helps to understand the program easily.
2 : as different symbols are used to specify the type
of operation performed, it is easier to understand the
complex programs with the help of flowcharts.
Flowcharts Symbols
S.N Description Symbols
O
1 Flowlines : These are the left to right or top to
bottom lines connection symbols. These lines
shows the flow of control through the
program.
2 Terminal Symbol : The oval shaped symbol
always begins and ends the flowchart. Every
flow chart starting and ending symbol is start End
terminal symbol.

3 Input / Output symbol : The parallelogram is


used for both input (Read) and Output (Write)
is called I/O symbol. This symbol is used to
denote any function of an I/O device in the
program.
Flowcharts Symbols
S.NO Description Symbols

4 Process Symbol : The rectangle symbol


is called process symbol. It is used for
calculations and initialization of memory
locations.
5 Decision symbol : The diamond shaped
symbol is called decision symbol. This box
is used for decision making. There will be
always two exists from a decision symbol
one is labeled YES and other labeled NO.
6 Connectors : The connector symbol is
represented by a circle. Whenever a
complex flowchart is morethan one page,
in such a situation, the connector symbols
are used to connect the flowchart.
Flowcharts
Flowcharts
Flowcharts

You might also like