22CS110 - 210-Unit-1 - Art of Programming Through Algorithms and Flowcharts
22CS110 - 210-Unit-1 - Art of Programming Through Algorithms and Flowcharts
Page 1 of 7
FLOWCHART: A schematic representation of a process
A graphic representation of an algorithm, often used in the design phase of programming
to work out the logical flow of a program. A flowchart is a diagrammatic representation
that illustrates the sequence of operations to be performed to get the solution of a
problem. Flowcharts facilitate communication between programmers and business
people. Once the flowchart is drawn, it becomes easy to write the program in any
high-level language. Often, we see how flowcharts are helpful in explaining the program
to others. A flowchart is a must for the better documentation of a complex program.
The benefits of flowcharts are as follows:
1. Communication: Flowcharts are better way of communicating the logic of a system to all
concerned.
2. Effective analysis: With the help of flowchart, problem can be analysed in more effective way.
3. Proper documentation: Program flowcharts serve as a good program documentation, which is
needed for various purposes.
4. Efficient Coding: The flowcharts act as a guide or blueprint during the systems analysis and
program development phase.
5. Proper Debugging: The flowchart helps in debugging process.
6. Efficient Program Maintenance: The maintenance of operating program becomes easy with the
help of flowchart. It helps the programmer to put efforts more efficiently on that part.
Guidelines for drawing a flowchart: Flowcharts are usually drawn using following
standard symbols;
Name Symbol Use in Flowchart / Function
Oval Denotes the Beginning or End of a program.
Page 2 of 7
Pseudocode is a compact and informal high-level description of a computer
programming algorithm that uses the structural conventions of a programming language,
but is intended for human reading rather than machine reading. Pseudocode typically
omits details that are not essential for human understanding of the algorithm, such as
variable declarations, system-specific code and subroutines. No standard for pseudocode
syntax exists, as a program in pseudocode is not an executable program. Pseudocode
resembles, but should not be confused with, skeleton programs including dummy code,
which can be compiled without errors. Flowcharts can be thought of as a graphical
alternative to pseudocode.
DIVIDE AND CONQUER STRATEGY
The divide-and-conquer methodology is very similar to the modularization approach to
software design. Small instance of a problem is solved using some direct approach.
To solve large instance,
(a) We divide it into two or more smaller instances,
(b) Solve each of these smaller problems, and
(c) Combines the solutions of these smaller problems to obtain the solution to the
original instance.
The smaller instances are often instances of the original problem and may be solved using
the divide-and-conquer strategy recursively. Problems like Sorting (Quick, Merge) Binary
Searching etc.,
Writing algorithms and Drawing Flowcharts for simple exercises:
(i) Swapping content of two variables.
(ii) Largest of given three numbers.
(iii) Solving a given quadratic equation.
(iv) Factorial of a given integer.
Page 3 of 7
(i) Swapping content of two variables.
Algorithm: To swap content of two variables.
STEPS PROCEDURES
Step-1: Begin
Step-2: Read the value of A and B
Step-3: Assign, Temp = A or A = A + B
A=B or B = A - B
B = Temp or A = A - B
Step-4: Print “The Value of A and B”, A, B
Step-5: End
Flowchart: To swap content of two variables.
Page 4 of 7
Flowchart: To find the largest of given three numbers.
Page 5 of 7
Flowchart: To find the solution of the quadratic equation.
No Yes
Page 6 of 7
Flowchart: To find the factorial of a given integer. (N!)
Page 7 of 7