Introduction To Problem Solving Techniques: Structure
Introduction To Problem Solving Techniques: Structure
Introduction To Problem Solving Techniques: Structure
Structure
1.0 Introduction
1.1 Procedure (steps involved in problem solving)
1.2 Algorithm
1.3 Flow Chart
1.4 Symbols used in Flow Charts
1.5 Pseudo Code
Learning Objectives
• To understand the concept of Problem solving
• To understand steps involved in algorithm development
• To understand the concept of Algorithm
• Develop Algorithm for simple problem
• To understand the concept of Flowchart development
• Draw the symbols used in Flowcharts
250 Computer Science and Engineering
1.0 Introduction
A computer is a very powerful and versatile machine capable of performing
a multitude of different tasks, yet it has no intelligence or thinking power. The
intelligence Quotient (I.Q) of a computer is zero. A computer performs many
tasks exactly in the same manner as it is told to do. This places responsibility on
the user to instruct the computer in a correct and precise manner, so that the
machine is able to perform the required job in a proper way. A wrong or
ambiguous instruction may sometimes prove disastrous.
In order to instruct a computer correctly, the user must have clear
understanding of the problem to be solved. A part from this he should be able to
develop a method, in the form of series of sequential steps, to solve it. Once the
problem is well-defined and a method of solving it is developed, then instructing
he computer to solve the problem becomes relatively easier task.
Thus, before attempt to write a computer program to solve a given problem.
It is necessary to formulate or define the problem in a precise manner. Once the
problem is defined, the steps required to solve it, must be stated clearly in the
required order.
1.1 Procedure (Steps Involved in Problem Solving)
A computer cannot solve a problem on its own. One has to provide step
by step solutions of the problem to the computer. In fact, the task of problem
solving is not that of the computer. It is the programmer who has to write down
the solution to the problem in terms of simple operations which the computer
can understand and execute.
In order to solve a problem by the computer, one has to pass though certain
stages or steps. They are
1. Understanding the problem
2. Analyzing the problem
3. Developing the solution
4. Coding and implementation.
1. Understanding the problem: Here we try to understand the problem
to be solved in totally. Before with the next stage or step, we should be absolutely
sure about the objectives of the given problem.
2. Analyzing the problem: After understanding thoroughly the problem
to be solved, we look different ways of solving the problem and evaluate each
Paper - II Programming in C 251
4. Write down an algorithm to find the largest data value of a set of given
data values
Algorithm largest of all data values:
Step 1: LARGE 0
Step 2: read NUM
Step 3: While NUM > = 0 do
3.1 if NUM > LARGE
3.1.1 then
3.1.1.1 LARGE NUM
3.2. read NUM
Step 4: Write “largest data value is”, LARGE
Step 5: end.
5. Write an algorithm which will test whether a given integer value is prime
or not.
Algorithm prime testing:
Step 1: M 2
Step 2: read N
Step 3: MAX SQRT (N)
Step 4: While M < = MAX do
4.1 if (M* (N/M) = N
4.1.1 then
4.1.1.1 go to step 7
4.2. M M + 1
Step 5: Write “number is prime”
Step 6: go to step 8
Step 7: Write “number is not a prime”
Step 8: end.
Paper - II Programming in C 255
e. Flow Lines: Flow lines indicate the direction being followed in the
flowchart. In a Flowchart, every line must have an arrow on it to indicate the
direction. The arrows may be in any direction
f. On- Page connectors: Circles are used to join the different parts of a
flowchart and these circles are called on-page connectors. The uses of these
connectors give a neat shape to the flowcharts. Ina complicated problems, a
flowchart may run in to several pages. The parts of the flowchart on different
258 Computer Science and Engineering
pages are to be joined with each other. The parts to be joined are indicated by
the circle.
START
INPUT A,B,C
D = B2 - 4 * A * C
YES
IS
D< O
NO
YES IS
output complex roots
D= O
NO
x = B/2*A x =B + D y = -B + D
y = B/2*A
2xA 2xA
Print X,Y
Print X,Y
Stop
Paper - II Programming in C 259
2. Draw a flowchart to find out the biggest of the three unequal positive
numbers.
Print Sum
260 Computer Science and Engineering
Activity
Practice more sample problems on algorithm and Flowcharts
Model Questions
Short Answer Type Questions - 2 Marks
1. Define Algorithm
2. What is Flowchart
3. What is Pseudo code?
4. What are the symbols of Flowchart
5. Write an Algorithm for perimeter of Triangle
6. What are the basic steps involved In problem solving
Long Answer Type Questions - 6 Marks
1. Differentiate between Algorithm and Flowchart.
2. Write an algorithm to find greatest of given three numbers.
3. Write an algorithm to check whether given integer value is PRIME or
NOT.
4. Draw the flowchart to find roots of Quadratic equation ax2+ bx + c = 0
Note : Practice more related Algorithms and Flowcharts.