2. Introduction to Problem Solving
Is a process of transforming the description of a problem into the solution by using
our knowledge of the problem domain and selecting and using appropriate
problem-solving Strategies, Techniques and Tools.
To find a solution for a problem in programming, we need to develop programs.
To develop a program, whether it is small or complex, a special procedure called
Program Development Life Cycle (PDLC) is required.
A computer program is a set of instructions which is used to solve a problem.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
2
3. Problem Solving Process
To solve any problem in an efficient way, a programmer follows the following steps:
Problem definition and analysis
Program design
Coding
Compilation
Debugging and testing
Documentation
Implementation and maintenance
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
3
4. Problem definition and analysis
To identify and define the problem by studying it thoroughly.
State the problem clearly and unambiguously (Doubtless) to understand exactly:
What the problem is?
What is needed to solve it?
What the solution should provide?
If there are constraints and special condition?
The nature of the problem is fully understood.
Analyse using the basic steps i.e. input, processing and output.
Input: the information fed into computer to solve the problem.
Processing: the operation to convert input to output.
Output: the result obtained after solving problem.
Special constraints or conditions (if any).
Formulas and equations to be used.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
4
5. Program design
A programmer must have a proper understanding of the behaviour of the problem.
To design a program, different techniques are available:
Algorithm: a finite set of steps that specify a sequence of operations to be carried out in
order to solve a specific problem.
Flow chart: a graph used to depict or show a step by step solution by use of symbols.
Pseudocode: a semi-formal English-like language with limited vocabulary, used to design
and describe algorithms.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
5
6. Coding
After the creation of algorithms, flow charts and pseudocodes, the design must be
converted into a form used by the computer.
A programmer translates the design into a computer program using a
programming language such as C or any other language.
A program is written i.e. source code is ready to enter into a computer and store it
in a disk with an extension “.c”.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
6
7. Compilation
To translate the program into machine language using a Compiler.
Compiler takes and process program.
Compiler accepts source code and convert it into an object code.
If some errors exist in the source code, then compiler prints the appropriate
messages for particular error.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
7
8. Debugging and testing
A bug is an error in a program.
Process of eliminating bugs.
Testing is done to make sure that the program is correct.
The program performs its intended task?
Program is executed with all the possible set of inputs whose output is already
known.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
8
9. Documentation
Is written text or illustration that accompanies computer program or is embedded
in the source code.
Explains how the software operates or how to use it.
Guidelines for creating the documentation:
should be from the point of view of the reader.
should be unambiguous.
should be no repetition.
should meet Industry standards.
should always be updated.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
9
10. Implementation and Maintenance
Program is installed at the user’s site.
If user faces some problems or errors in the program, the programmer have to
maintain and do the necessary changes to remove these errors.
Even after completion, maintenance is regular process, so that the program must
be fulfilling all its objectives efficiently.
By: Satveer Kaur, Assistant Professor, Khalsa College, Patiala.
10