You are on page 1of 18

Fo

rA
pt
ec
h
C
en
tre
U
se
O
nl
y
y
nl
O
Explain algorithm

se
Explain flowcharts

U
Explain pseudocodes

tre
en
C
h
ec
pt
rA
Fo
y
nl
O
The programmer has to plan and write down

se
the solution to a problem in a particular

U
manner and this is known as algorithm.

tre
en
The two tools used by the programmer are
C
h
flowchart and pseudocode.
ec
pt
rA
Fo
y
nl
O
Algorithm is an ordered set of instructions.

se
U
The algorithm should have the ability to alter the

tre
order of execution of the instructions.

en
C
The three types of statement constructs that an
h
algorithm can have are as follows:
ec

Sequential
pt

Conditional
rA

Iteration
Fo
y
nl
O
A flowchart is a graphical representation of an
algorithm.

se
U
It charts the logical flow of instructions or

tre
activities in a process.

en
C
Flowcharts help programmers to view how the
h
statements in a program are interrelated.
ec
pt
rA

Each activity in a flowchart is depicted using


symbols.
Fo
y
nl
O
 Consider a program accepting two numbers from the user

se
and displaying the sum of the two numbers using a third
variable. The flowchart for this example is shown in the

U
figure.

tre
en
C
h
ec
pt
rA
Fo
y
nl
O
 Some of the essential points to be considered while
drawing a flowchart are as follows:

se
 Initially concentrate on the logic of the problem and draw

U
out the main path of the flowchart

tre
 Maintain consistent level of detail for a flowchart
 Must not contain minute details. Only the essential and

en
meaningful steps need to be represented
C
 Common and easy to understand words should be used
h
 Consistent usage of variable names
ec

 Flow should be from left to right and top to bottom


pt

 Must have only one START and one STOP point


rA

 Should be simple
Fo
y
nl
O
Some of the advantages of using flowcharts

se
are as follows:

U
Easy to understand

tre
Effective analysis of problem

en
Effective joining of different parts
Ease in coding
C
h
ec

Systematic debugging
pt

Systematic testing
rA
Fo
y
nl
O
Besides the advantages, flowcharts have some

se
disadvantages. They are as follows:

U
Time consuming

tre
Difficult to change

en
No standards
C
h
ec
pt
rA
Fo
y
nl
O
The best practices for drawing flowcharts are as

se
follows:

U
The direction of the arrow flow should be to one side

tre
either from top to bottom or from left to right.
Standard symbols must be used in a flowchart so that

en
it can be understood by all.
C
All the symbols in a flowchart must be named
h
appropriately.
ec

Use the connector symbol for complex flowcharts.


pt

The size of the symbols used in a flowchart must be


rA

consistent.
Fo
y
nl
O
The word pseudo means false. As the name

se
suggest, pseudocode is not the actual code.

U
tre
It is a method of algorithm writing which uses

en
a certain standard set of words which makes it
resemble a code.C
h
ec
pt

However, pseudocode cannot be complied or


rA

executed as a code.
Fo
y
nl
O
 Each pseudocode must start with the word BEGIN or
START, and end with END or STOP.

se
U
 The statements between START and END are English

tre
phrases and indented to make the word START and

en
END stand out.

C
 To display some value, the word DISPLAY, WRITE, or
h
ec

PRINT is used.
pt

 To accept a value from the user, the word INPUT or


rA

READ is used.
Fo
y
nl
O
 The pseudocode shows the process to store the sum of variables in
a third variable, and then display the value stored in this third

se
variable as shown in the example.

U
BEGIN

tre
INPUT A, B

en
C = A + B
DISPLAY C
END C
h
ec

 A set of instructions or steps in a pseudocode is collectively called a


pt

construct. There are three types of programming constructs


rA

namely, sequence, selection, and iteration.


Fo
y
nl
O
Some of the rules to be followed while writing

se
pseudocodes are as follows:

U
The pseudocode must be easy to understand by

tre
all and not just the programmer. The variables

en
mentioned in the pseudocode must be self-
C
descriptive. Avoid using abbreviations and
h
shortened versions of words in the pseudocode.
ec

The pseudocode must not contain actual


pt
rA

programming code but should have only logical


steps to show how to operate a code.
Fo
y
nl
O
Some of the advantages of using pseudocode

se
are as follows:

U
Easy to create

tre
No symbols

en
No specific syntax
C
Easy to translate
h
ec

Reduces time
pt
rA
Fo
y
nl
O
Besides the advantages, pseudocodes have

se
some disadvantages. They are as follows:

U
Lack of standards

tre
Do not focus on big picture

en
C
h
ec
pt
rA
Fo
y
nl
O
 The best practices for writing pseudocodes are as
follows:

se
 The vocabulary used to write a pseudocode must be

U
simple to understand and should be on the lines of

tre
structured programming.
 Each statement in the pseudocode must be written in a

en
separate line.
C
 The keywords, procedure names, and module names must
be capitalized in pseudocode.
h
ec

 Use descriptive names that can be understood by non-


technical persons also.
pt

 Maintain consistency when using generic terms such as


rA

DISPLAY, PRINT, END, and so on.


 Indent the statements as required to show logical
Fo

hierarchy.
y
nl
 An algorithm can be defined as a procedure, formula, or recipe for

O
solving a problem.

se
 A flowchart is a graphical representation of an algorithm. It charts
the flow of instructions or activities in a process. Each activity in a

U
flowchart is depicted using symbols.

tre
 A flowchart begins with the START or BEGIN keyword, and ends
with the END and STOP keyword.

en
 The DISPLAY keyword is used to display some value to the user in a
flowchart.
C
 Pseudocode is not actual code. It is a method of algorithm writing
h
which uses a certain standard set of words which makes it resemble
ec

a code.
pt

 Each pseudocode must start with the word BEGIN or START, and
rA

end with END or STOP.


 The word DISPLAY, PRINT, or WRITE is used to display some value in
Fo

pseudocode.

You might also like