UNIT-1
Problem Solving Process
The process of problem-solving is an activity which has its ingredients as the
specification of the program and the served dish is a correct program. This
activity comprises of four steps :
1. Understanding the problem: To solve any problem it is very crucial to
understand the problem first. What is the desired output of the code and
how that output can be generated? The obvious and essential need to
generate the output is an input. The input may be singular or it may be a set
of inputs. A proper relationship between the input and output must be drawn
in order to solve the problem efficiently. The input set should be complete
and sufficient enough to draw the output. It means all the necessary inputs
required to compute the output should be present at the time of
computation. However, it should be kept in mind that the programmer
should ensure that the minimum number of inputs should be there. Any
irrelevant input only increases the size of and memory overhead of the
program. Thus Identifying the minimum number of inputs required for
output is a crucial element for understanding the problem.
2. Devising the plan: Once a problem has been understood, a proper action
plan has to be devised to solve it. This is called devising the plan. This step
usually involves computing the result from the given set of inputs. It uses the
relationship drawn between inputs and outputs in the previous step. The
complexity of this step depends upon the complexity of the problem at hand.
3. Executing the plan: Once the plan has been defined, it should follow the
trajectory of action while ensuring the plan’s integrity at various checkpoints.
If any inconsistency is found in between, the plan needs to be revised.
4. Evaluation: The final result so obtained must be evaluated and verified to
see if the problem has been solved satisfactorily.
, Problem Definition/Specification: A computer program is basically a machine
language solution to a real-life problem. Because programs are generally
made to solve the pragmatic problems of the outside world. In order to solve
the problem, it is very necessary to define the problem to get its proper
understanding. For example, suppose we are asked to write a code for “
Compute the average of three numbers”. In this case, a proper definition of
the problem will include questions like :
“What exactly does average mean?”
“How to calculate the average?”
Once, questions like these are raised, it helps to formulate the solution of the
problem in a better way. Once a problem has been defined, the program’s
specifications are then listed. Problem specifications describe what the
program for the problem must do. It should definitely include :
INPUT :
what is the input set of the program
OUTPUT :
What is the desired output of the program and in what form the output is
desired?
Problem Analysis (Breaking down the solution into simple steps): This step of
solving the problem follows a modular approach to crack the nut. The problem
is divided into subproblems so that designing a solution to these subproblems
gets easier. The solutions to all these individual parts are then merged to get
the final solution of the original problem. It is like divide and merge approach.
Modular Approach for Programming :
The process of breaking a large problem into subproblems and then treating
these individual parts as different functions is called modular programming.
Each function behaves independent of another and there is minimal inter-
functional communication. There are two methods to implement modular
programming :
Top Down Design : In this method, the original problem is divided into
subparts. These subparts are further divided. The chain continues till we get
Problem Solving Process
The process of problem-solving is an activity which has its ingredients as the
specification of the program and the served dish is a correct program. This
activity comprises of four steps :
1. Understanding the problem: To solve any problem it is very crucial to
understand the problem first. What is the desired output of the code and
how that output can be generated? The obvious and essential need to
generate the output is an input. The input may be singular or it may be a set
of inputs. A proper relationship between the input and output must be drawn
in order to solve the problem efficiently. The input set should be complete
and sufficient enough to draw the output. It means all the necessary inputs
required to compute the output should be present at the time of
computation. However, it should be kept in mind that the programmer
should ensure that the minimum number of inputs should be there. Any
irrelevant input only increases the size of and memory overhead of the
program. Thus Identifying the minimum number of inputs required for
output is a crucial element for understanding the problem.
2. Devising the plan: Once a problem has been understood, a proper action
plan has to be devised to solve it. This is called devising the plan. This step
usually involves computing the result from the given set of inputs. It uses the
relationship drawn between inputs and outputs in the previous step. The
complexity of this step depends upon the complexity of the problem at hand.
3. Executing the plan: Once the plan has been defined, it should follow the
trajectory of action while ensuring the plan’s integrity at various checkpoints.
If any inconsistency is found in between, the plan needs to be revised.
4. Evaluation: The final result so obtained must be evaluated and verified to
see if the problem has been solved satisfactorily.
, Problem Definition/Specification: A computer program is basically a machine
language solution to a real-life problem. Because programs are generally
made to solve the pragmatic problems of the outside world. In order to solve
the problem, it is very necessary to define the problem to get its proper
understanding. For example, suppose we are asked to write a code for “
Compute the average of three numbers”. In this case, a proper definition of
the problem will include questions like :
“What exactly does average mean?”
“How to calculate the average?”
Once, questions like these are raised, it helps to formulate the solution of the
problem in a better way. Once a problem has been defined, the program’s
specifications are then listed. Problem specifications describe what the
program for the problem must do. It should definitely include :
INPUT :
what is the input set of the program
OUTPUT :
What is the desired output of the program and in what form the output is
desired?
Problem Analysis (Breaking down the solution into simple steps): This step of
solving the problem follows a modular approach to crack the nut. The problem
is divided into subproblems so that designing a solution to these subproblems
gets easier. The solutions to all these individual parts are then merged to get
the final solution of the original problem. It is like divide and merge approach.
Modular Approach for Programming :
The process of breaking a large problem into subproblems and then treating
these individual parts as different functions is called modular programming.
Each function behaves independent of another and there is minimal inter-
functional communication. There are two methods to implement modular
programming :
Top Down Design : In this method, the original problem is divided into
subparts. These subparts are further divided. The chain continues till we get