Introduction To Problem Solving
Introduction To Problem Solving
Introduction To Problem Solving
Topic
Introduction to Problem
Solving
Prepared by:
S K Kothiyal
PGT(CS)
K V Pithoragarh
Problem Solving
• In order to create efficient & effective
programs, we should adopt a proper
problem solving methodology and
use appropriate techniques.
• Problem solving requires four main
steps:
1. Identify & analyze the problem.
2. Find its solution & develop algorithm of
the solution.
3. Code the solution in a programming
language.
4. Test & debug the coded solution.
Steps while writing a Program
1. Understand the problem well
2. Analyze the problem
a) Identify minimum number of input required for output.
b) Identify processing component
3. Design the program by:
c) Deciding step by step solution
d) Breaking down solution into simple steps.
4. Code the program by:
e) Identifying arithmetic & logical operations required for
solutions.
f) Using appropriate control structures (e.g. conditional or
looping control structures).
5. Test & Debug your program by:
g) Finding errors in it. b) Rectifying errors
6. Complete the documentation.
7. Maintain your program
Testing & Debugging
• Testing is the process of finding errors in a
program.
• Debugging is the process of correcting errors
found during the testing process.
Algorithm
• The set of rules that defines how a particular problem can be
solved in finite number of steps is known as ALGORITHM.
• An algorithm is composed of a finite set of steps, each of
which may require one or more operations.
• Characteristics of Algorithm:
a) Precision b) Uniqueness c) Finiteness
d) Input e) Output
• Component of Algorithm:
a) Input b) Processing c) Output
• The success of a program depends upon the algorithm.
Therefore, logic of the problem must be clearly expressed in
the algorithm.
Pseudocode (स्यूडो कोड)