Page 91 - Computer Science Class 11 Without Functions
P. 91
1. Programming language: A language that a computer understands.
2. Program (code): A sequence of instructions in a programming language for solving a problem.
Once a program to solve the problem at hand is developed, it needs to be tested. When a program is tested, errors
(called bugs) are often found that need to be fixed. Often, these errors relate to the program that you developed,
but sometimes one may discover an error in the specification of the problem itself. In any case, all errors must be
corrected. Fig 4.1 depicts the steps in problem-solving using computers:
Testing and
Problem Analysis Problem Design Coding
Debugging
Fig 4.1: Problem-solving cycle
1. Problem Analysis: As mentioned above, before endeavoring to solve a problem, it is important to know exactly
what the problem is. If we do not have a clear idea of the problem we are trying to solve, we might build a solution
that does not solve the problem at hand. So, we need to analyze the problem carefully to determine the most
important tasks our solution must achieve. First, we must identify what inputs the program would need and what
outputs it must produce. If a problem is too complex, you would need to divide it into subproblems, solve each
subproblem, and combine the solutions to individual problems to solve the original problem. The solution to each
subproblem is called a module and this method of problem-solving is called the modular approach.
The process of dividing a complex problem into subproblems, solving the subproblems, and merging the solutions
to the subproblems to solve the original problem is called the modular approach.
For example, suppose you live at 1 Vaishali, Pitampura, New Delhi - 110034. You receive an invitation from your friend
Akbar, who lives in Chikalthana village in Aurangabad, Maharashtra. To reach him, you divide the problem of reaching
your friend into parts as follows:
A. How to reach the place from where you would get transport to Aurangabad
B. How to travel from Delhi to Aurangabad?
C. How to travel from Aurangabad to Chikalthana village?
D. On arriving at Chikalthana village, how to reach your friend's home?
Note that the crucial step in the above problem is how to travel from Delhi to Aurangabad. Indeed, steps A and C
depend on this step. After analyzing various options, you find three solutions:
● Travel by Air: Cost about INR 10,000. Travel time: about 2 Hours
● Travel by Train: Travel time: about 26 Hours
Cost about INR 3,200, By AC 3 Tier
Cost about INR 600, By Second Class,
● Travel by Car: About 22 Hours of Driving, Cost: INR 12,000 plus significant fatigue.
After thinking about the above choices, you decide against driving because it would be too hard. Further, flying being
too expensive for you, you decide to travel by train. You prefer an AC 3-tier ticket because it is winter. Once you decide
this, you figure out that your train will leave from New Delhi railway station. So, you solve the problem of reaching
the New Delhi railway station from your home. Similarly, you find out how to reach the village of Chikalthana from
Aurangabad station. You know that once you are in the village of Chikalthana, you will be able to reach your friend's
home with the help of some local people. Thus, using the modular approach, you have been able to build a solution to
the complete task of reaching your friend's home.
Problem Solving 89

