Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Algorithm
Algorithm

➢ An algorithm is a set of well-defined instructions to solve a particular problem.


➢ It takes a set of input(s) and produces the desired output.
➢ For example,
An algorithm to add two numbers :-
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
Algorithm
E.g. :- Find the largest number among three numbers

Step 1: Start
Step 2: Declare variables a,b and c.
Step 3: Read variables a,b and c.
Step 4: If a > b
If a > c
Display a is the largest number.
Else
Display c is the largest number.
Else
If b > c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop

Pseudocode
Pseudocode
Set of instructions that
mimic programming
language instructions

Pseudocode consists of
short, readable and
formally styled English
languages used for explain
an algorithm.

Flowchart
Flowchart

➢ Flowchart is a diagrammatic representation of sequence of logical steps of a program.


Or
Flowchart is a diagrammatic/graphical representation of an algorithm.

➢ A flowchart can be helpful for both writing programs and explaining the program to
others.Programmers often use it as a program-planning tool to solve a problem.

➢ Flowcharts use simple geometric shapes to depict processes and arrows to show
relationships and process/data flow.

➢ The process of drawing a flowchart for an algorithm is known as “flowcharting”.


“ Flowchart
Symbols
Flowchart Smbols
“ Flowchart
Rules
Flowchart Rules

Rules For Creating Flowchart :-

Rule 1: Flowchart opening statement must be ‘start’ keyword.


Rule 2: Flowchart ending statement must be ‘end’ keyword.
Rule 3: Flowchart can have only one start and one stop symbol.
Rule 4: All symbols in the flowchart must be connected with an arrow line.
Rule 5: Arrows should not cross each other.
Rule 6: On-page connectors are referenced using numbers.
Rule 7: Off-page connectors are referenced using alphabets.
Rule 8: General flow of processes is top to bottom or left to right.
“ Flowchart
Advantages &
Disadvantages
Advantages
Advantages of Flowchart :-
▪ Flowcharts are a better way of communicating the logic of the system.
▪ Flowcharts act as a guide for blueprint during program designed.
▪ Flowcharts help in debugging process.
▪ With the help of flowcharts programs can be easily analyzed.
▪ It provides better documentation.
▪ Flowcharts serve as a good proper documentation.
▪ Easy to trace errors in the software.
▪ Easy to understand.
▪ The flowchart can be reused for inconvenience in the future.
▪ It helps to provide correct logic.
Disadvantages
Disadvantages of Flowchart :-

▪ It is difficult to draw flowcharts for large and complex programs.


▪ There is no standard to determine the amount of detail.
▪ Difficult to reproduce the flowcharts.
▪ It is very difficult to modify the Flowchart.
▪ Making a flowchart is costly.
▪ Some developer thinks that it is waste of time.
▪ It makes software processes low.
▪ If changes are done in software, then the flowchart must be redrawn.
Add 2 Numbers
Flowchart Smbols
Largest among
two Numbers
Largest among
three Numbers
Add 2 Numbers
THANKS

You might also like