Humanities/Arts Exam  >  Humanities/Arts Notes  >  Computer Science for Class 11  >  NCERT Textbook: Introduction to Problem Solving

NCERT Textbook: Introduction to Problem Solving | Computer Science for Class 11 - Humanities/Arts PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


“Computer Science is a 
science of abstraction 
-creating the right model for 
a problem and devising the 
appropriate mechanizable 
techniques to solve it.”
–A. Aho and J. Ullman
Chapter 4 
Introduction to 
Problem Solving
In this chapter  
 » Introduction 
 » Steps for Problem 
Solving
 » Algorithm
 » Representation of 
Algorithms
 » Flow of Control
 » Verifying Algorithms
 » Comparison of 
Algorithm
 » Coding
 » Decomposition
4.1 Introduct Ion Today, computers are all around us. We use them 
for doing various tasks in a faster and more accurate 
manner. For example, using a computer or smartphone, 
we can book train tickets online. 
India is a big country and we have an enormous 
railway network. Thus, railway reservation is a complex 
task. Making reservation involves information about 
many aspects, such as details of trains (train type, types 
of berth and compartments in each train, their schedule, 
etc.), simultaneous booking of tickets by multiple users 
and many other related factors.  
It is only due to the use of computers that today, 
the booking of the train tickets has become easy. Online 
booking of train tickets has added to our comfort by 
enabling us to book tickets from anywhere, anytime. 
We usually use the term computerisation to indicate 
the use of computer to develop software in order to 
automate any routine human task efficiently. Computers 
are used for solving various day-to-day problems 
and thus problem solving is an essential skill that a 
computer science student should know. It is pertinent 
to mention that computers themselves cannot solve a 
problem. Precise step-by-step instructions should be 
given by us to solve the problem. Thus, the success of a 
computer in solving a problem depends on how correctly 
and precisely we define the problem, design a solution 
(algorithm) and implement the solution (program) using 
a programming language. Thus, problem solving is the 
process of identifying a problem, developing an algorithm 
for the identified problem and finally implementing the 
algorithm to develop a computer program.
Ch 4.indd   61 21-May-19   11:45:27 AM
2024-25
Page 2


“Computer Science is a 
science of abstraction 
-creating the right model for 
a problem and devising the 
appropriate mechanizable 
techniques to solve it.”
–A. Aho and J. Ullman
Chapter 4 
Introduction to 
Problem Solving
In this chapter  
 » Introduction 
 » Steps for Problem 
Solving
 » Algorithm
 » Representation of 
Algorithms
 » Flow of Control
 » Verifying Algorithms
 » Comparison of 
Algorithm
 » Coding
 » Decomposition
4.1 Introduct Ion Today, computers are all around us. We use them 
for doing various tasks in a faster and more accurate 
manner. For example, using a computer or smartphone, 
we can book train tickets online. 
India is a big country and we have an enormous 
railway network. Thus, railway reservation is a complex 
task. Making reservation involves information about 
many aspects, such as details of trains (train type, types 
of berth and compartments in each train, their schedule, 
etc.), simultaneous booking of tickets by multiple users 
and many other related factors.  
It is only due to the use of computers that today, 
the booking of the train tickets has become easy. Online 
booking of train tickets has added to our comfort by 
enabling us to book tickets from anywhere, anytime. 
We usually use the term computerisation to indicate 
the use of computer to develop software in order to 
automate any routine human task efficiently. Computers 
are used for solving various day-to-day problems 
and thus problem solving is an essential skill that a 
computer science student should know. It is pertinent 
to mention that computers themselves cannot solve a 
problem. Precise step-by-step instructions should be 
given by us to solve the problem. Thus, the success of a 
computer in solving a problem depends on how correctly 
and precisely we define the problem, design a solution 
(algorithm) and implement the solution (program) using 
a programming language. Thus, problem solving is the 
process of identifying a problem, developing an algorithm 
for the identified problem and finally implementing the 
algorithm to develop a computer program.
Ch 4.indd   61 21-May-19   11:45:27 AM
2024-25
Computer SCien Ce – Cla SS xi 62
4.2 Step S for p roblem Solv Ing Suppose while driving, a vehicle starts making a strange 
noise. We might not know how to solve the problem 
right away. First, we need to identify from where the 
noise is coming? In case the problem cannot be solved 
by us, then we need to take the vehicle to a mechanic. 
The mechanic will analyse the problem to identify the 
source of the noise, make a plan about the work to be 
done and finally repair the vehicle in order to remove 
the noise. From the above example, it is explicit that, 
finding the solution to a problem might consist 
of multiple steps. 
When problems are straightforward and easy, 
we can easily find the solution. But a complex 
problem requires a methodical approach to 
find the right solution. In other words, we have 
to apply problem solving techniques. Problem 
solving begins with the precise identification of 
the problem and ends with a complete working 
solution in terms of a program or software. 
Key steps required for solving a problem using 
a computer are shown in Figure 4.1 and are 
discussed in following subsections.
4.2.1 Analysing the problem
It is important to clearly understand a problem before 
we begin to find the solution for it. If we are not clear 
as to what is to be solved, we may end up developing 
a program which may not solve our purpose. Thus, 
we need to read and analyse the problem statement 
carefully in order to list the principal components of 
the problem and decide the core functionalities that 
our solution should have. By analysing a problem, we 
would be able to figure out what are the inputs that 
our program should accept and the outputs that it  
should produce. 
4.2.2 Developing an Algorithm 
It is essential to device a solution before writing a program 
code for a given problem. The solution is represented in 
natural language and is called an algorithm. We can 
imagine an algorithm like a very well-written recipe for 
GIGO (Garbage In Garbage 
Out)
The correctness of the 
output that a computer 
gives depends upon the 
correctness of input 
provided.
Figure 4.1: Steps for problem solving
Algorithm
A set of exact steps 
which when followed, 
solve the problem 
or accomplish the 
required task. 
Ch 4.indd   62 08-Apr-19   12:34:19 PM
2024-25
Page 3


“Computer Science is a 
science of abstraction 
-creating the right model for 
a problem and devising the 
appropriate mechanizable 
techniques to solve it.”
–A. Aho and J. Ullman
Chapter 4 
Introduction to 
Problem Solving
In this chapter  
 » Introduction 
 » Steps for Problem 
Solving
 » Algorithm
 » Representation of 
Algorithms
 » Flow of Control
 » Verifying Algorithms
 » Comparison of 
Algorithm
 » Coding
 » Decomposition
4.1 Introduct Ion Today, computers are all around us. We use them 
for doing various tasks in a faster and more accurate 
manner. For example, using a computer or smartphone, 
we can book train tickets online. 
India is a big country and we have an enormous 
railway network. Thus, railway reservation is a complex 
task. Making reservation involves information about 
many aspects, such as details of trains (train type, types 
of berth and compartments in each train, their schedule, 
etc.), simultaneous booking of tickets by multiple users 
and many other related factors.  
It is only due to the use of computers that today, 
the booking of the train tickets has become easy. Online 
booking of train tickets has added to our comfort by 
enabling us to book tickets from anywhere, anytime. 
We usually use the term computerisation to indicate 
the use of computer to develop software in order to 
automate any routine human task efficiently. Computers 
are used for solving various day-to-day problems 
and thus problem solving is an essential skill that a 
computer science student should know. It is pertinent 
to mention that computers themselves cannot solve a 
problem. Precise step-by-step instructions should be 
given by us to solve the problem. Thus, the success of a 
computer in solving a problem depends on how correctly 
and precisely we define the problem, design a solution 
(algorithm) and implement the solution (program) using 
a programming language. Thus, problem solving is the 
process of identifying a problem, developing an algorithm 
for the identified problem and finally implementing the 
algorithm to develop a computer program.
Ch 4.indd   61 21-May-19   11:45:27 AM
2024-25
Computer SCien Ce – Cla SS xi 62
4.2 Step S for p roblem Solv Ing Suppose while driving, a vehicle starts making a strange 
noise. We might not know how to solve the problem 
right away. First, we need to identify from where the 
noise is coming? In case the problem cannot be solved 
by us, then we need to take the vehicle to a mechanic. 
The mechanic will analyse the problem to identify the 
source of the noise, make a plan about the work to be 
done and finally repair the vehicle in order to remove 
the noise. From the above example, it is explicit that, 
finding the solution to a problem might consist 
of multiple steps. 
When problems are straightforward and easy, 
we can easily find the solution. But a complex 
problem requires a methodical approach to 
find the right solution. In other words, we have 
to apply problem solving techniques. Problem 
solving begins with the precise identification of 
the problem and ends with a complete working 
solution in terms of a program or software. 
Key steps required for solving a problem using 
a computer are shown in Figure 4.1 and are 
discussed in following subsections.
4.2.1 Analysing the problem
It is important to clearly understand a problem before 
we begin to find the solution for it. If we are not clear 
as to what is to be solved, we may end up developing 
a program which may not solve our purpose. Thus, 
we need to read and analyse the problem statement 
carefully in order to list the principal components of 
the problem and decide the core functionalities that 
our solution should have. By analysing a problem, we 
would be able to figure out what are the inputs that 
our program should accept and the outputs that it  
should produce. 
4.2.2 Developing an Algorithm 
It is essential to device a solution before writing a program 
code for a given problem. The solution is represented in 
natural language and is called an algorithm. We can 
imagine an algorithm like a very well-written recipe for 
GIGO (Garbage In Garbage 
Out)
The correctness of the 
output that a computer 
gives depends upon the 
correctness of input 
provided.
Figure 4.1: Steps for problem solving
Algorithm
A set of exact steps 
which when followed, 
solve the problem 
or accomplish the 
required task. 
Ch 4.indd   62 08-Apr-19   12:34:19 PM
2024-25
Introduct Ion to Problem Solv Ing 63
a dish, with clearly defined steps that, if followed, one 
will end up preparing the dish.
We start with a tentative solution plan and keep 
on refining the algorithm until the algorithm is able 
to capture all the aspects of the desired solution. For 
a given problem, more than one algorithm is possible 
and we have to select the most suitable solution. The 
algorithm is discussed in section 4.3.
4.2.3 Coding
After finalising the algorithm, we need to convert the 
algorithm into the format which can be understood by 
the computer to generate the desired solution. Different 
high level programming languages can be used for 
writing a program. 
It is equally important to record the details of the 
coding procedures followed and document the solution. 
This is helpful when revisiting the programs at a later 
stage. Coding is explained in detail in section 4.8.
4.2.4 Testing and Debugging
The program created should be tested on various 
parameters. The program should meet the requirements 
of the user. It must respond within the expected time. It 
should generate correct output for all possible inputs. 
In the presence of syntactical errors, no output will be 
obtained. In case the output generated is incorrect, then 
the program should be checked for logical errors, if any.
Software industry follows standardised testing 
methods like unit or component testing, integration 
testing, system testing, and acceptance testing while 
developing complex applications. This is to ensure 
that the software meets all the business and technical 
requirements and works as expected. The errors or 
defects found in the testing phases are debugged or 
rectified and the program is again tested. This continues 
till all the errors are removed from the program.
Once the software application has been developed, 
tested and delivered to the user, still problems in terms 
of functioning can come up and need to be resolved 
from time to time. The maintenance of the solution, 
thus, involves fixing the problems faced by the user, 
n ote S
Ch 4.indd   63 08-Apr-19   12:34:19 PM
2024-25
Page 4


“Computer Science is a 
science of abstraction 
-creating the right model for 
a problem and devising the 
appropriate mechanizable 
techniques to solve it.”
–A. Aho and J. Ullman
Chapter 4 
Introduction to 
Problem Solving
In this chapter  
 » Introduction 
 » Steps for Problem 
Solving
 » Algorithm
 » Representation of 
Algorithms
 » Flow of Control
 » Verifying Algorithms
 » Comparison of 
Algorithm
 » Coding
 » Decomposition
4.1 Introduct Ion Today, computers are all around us. We use them 
for doing various tasks in a faster and more accurate 
manner. For example, using a computer or smartphone, 
we can book train tickets online. 
India is a big country and we have an enormous 
railway network. Thus, railway reservation is a complex 
task. Making reservation involves information about 
many aspects, such as details of trains (train type, types 
of berth and compartments in each train, their schedule, 
etc.), simultaneous booking of tickets by multiple users 
and many other related factors.  
It is only due to the use of computers that today, 
the booking of the train tickets has become easy. Online 
booking of train tickets has added to our comfort by 
enabling us to book tickets from anywhere, anytime. 
We usually use the term computerisation to indicate 
the use of computer to develop software in order to 
automate any routine human task efficiently. Computers 
are used for solving various day-to-day problems 
and thus problem solving is an essential skill that a 
computer science student should know. It is pertinent 
to mention that computers themselves cannot solve a 
problem. Precise step-by-step instructions should be 
given by us to solve the problem. Thus, the success of a 
computer in solving a problem depends on how correctly 
and precisely we define the problem, design a solution 
(algorithm) and implement the solution (program) using 
a programming language. Thus, problem solving is the 
process of identifying a problem, developing an algorithm 
for the identified problem and finally implementing the 
algorithm to develop a computer program.
Ch 4.indd   61 21-May-19   11:45:27 AM
2024-25
Computer SCien Ce – Cla SS xi 62
4.2 Step S for p roblem Solv Ing Suppose while driving, a vehicle starts making a strange 
noise. We might not know how to solve the problem 
right away. First, we need to identify from where the 
noise is coming? In case the problem cannot be solved 
by us, then we need to take the vehicle to a mechanic. 
The mechanic will analyse the problem to identify the 
source of the noise, make a plan about the work to be 
done and finally repair the vehicle in order to remove 
the noise. From the above example, it is explicit that, 
finding the solution to a problem might consist 
of multiple steps. 
When problems are straightforward and easy, 
we can easily find the solution. But a complex 
problem requires a methodical approach to 
find the right solution. In other words, we have 
to apply problem solving techniques. Problem 
solving begins with the precise identification of 
the problem and ends with a complete working 
solution in terms of a program or software. 
Key steps required for solving a problem using 
a computer are shown in Figure 4.1 and are 
discussed in following subsections.
4.2.1 Analysing the problem
It is important to clearly understand a problem before 
we begin to find the solution for it. If we are not clear 
as to what is to be solved, we may end up developing 
a program which may not solve our purpose. Thus, 
we need to read and analyse the problem statement 
carefully in order to list the principal components of 
the problem and decide the core functionalities that 
our solution should have. By analysing a problem, we 
would be able to figure out what are the inputs that 
our program should accept and the outputs that it  
should produce. 
4.2.2 Developing an Algorithm 
It is essential to device a solution before writing a program 
code for a given problem. The solution is represented in 
natural language and is called an algorithm. We can 
imagine an algorithm like a very well-written recipe for 
GIGO (Garbage In Garbage 
Out)
The correctness of the 
output that a computer 
gives depends upon the 
correctness of input 
provided.
Figure 4.1: Steps for problem solving
Algorithm
A set of exact steps 
which when followed, 
solve the problem 
or accomplish the 
required task. 
Ch 4.indd   62 08-Apr-19   12:34:19 PM
2024-25
Introduct Ion to Problem Solv Ing 63
a dish, with clearly defined steps that, if followed, one 
will end up preparing the dish.
We start with a tentative solution plan and keep 
on refining the algorithm until the algorithm is able 
to capture all the aspects of the desired solution. For 
a given problem, more than one algorithm is possible 
and we have to select the most suitable solution. The 
algorithm is discussed in section 4.3.
4.2.3 Coding
After finalising the algorithm, we need to convert the 
algorithm into the format which can be understood by 
the computer to generate the desired solution. Different 
high level programming languages can be used for 
writing a program. 
It is equally important to record the details of the 
coding procedures followed and document the solution. 
This is helpful when revisiting the programs at a later 
stage. Coding is explained in detail in section 4.8.
4.2.4 Testing and Debugging
The program created should be tested on various 
parameters. The program should meet the requirements 
of the user. It must respond within the expected time. It 
should generate correct output for all possible inputs. 
In the presence of syntactical errors, no output will be 
obtained. In case the output generated is incorrect, then 
the program should be checked for logical errors, if any.
Software industry follows standardised testing 
methods like unit or component testing, integration 
testing, system testing, and acceptance testing while 
developing complex applications. This is to ensure 
that the software meets all the business and technical 
requirements and works as expected. The errors or 
defects found in the testing phases are debugged or 
rectified and the program is again tested. This continues 
till all the errors are removed from the program.
Once the software application has been developed, 
tested and delivered to the user, still problems in terms 
of functioning can come up and need to be resolved 
from time to time. The maintenance of the solution, 
thus, involves fixing the problems faced by the user, 
n ote S
Ch 4.indd   63 08-Apr-19   12:34:19 PM
2024-25
Computer SCien Ce – Cla SS xi 64
answering the queries of the user and even serving the 
request for addition or modification of features.
4.3 Algorithm In our day-to-day life we perform activities by following 
certain sequence of steps. Examples of activities include 
getting ready for school, making breakfast, riding a 
bicycle, wearing a tie, solving a puzzle and so on. To 
complete each activity, we follow a sequence of steps. 
Suppose following are the steps required for an activity 
‘riding a bicycle’: 
1) remove the bicycle from the stand,
2) sit on the seat of the bicycle, 
3) start peddling,
4) use breaks whenever needed and
5) stop on reaching the destination.
Let us now find Greatest Common Divisor (GCD) of two 
numbers 45 and 54.
Note: GCD is the largest number that divides both the  
given numbers.
Step 1: Find the numbers (divisors) which can divide the 
given numbers
 Divisors of 45 are: 1, 3, 5, 9, 15, and 45
 Divisors of 54 are: 1, 2, 3, 6, 9, 18, 27,  
 and 54
Step 2: Then find the l argest common number from these 
two lists.
  Therefore, GCD of 45 and 54 is 9 
Hence, it is clear that we need to follow a sequence 
of steps to accomplish the task. Such a finite sequence 
of steps required to get the desired output is called  
an algorithm. It will lead to the desired result in a finite 
amount of time, if followed correctly. Algorithm has a 
definite beginning and a definite end, and consists of a 
finite number of steps.
4.3.1 Why do we need an Algorithm?
A programmer writes a program to instruct the computer 
to do certain tasks as desired. The computer then follows 
the steps written in the program code. Therefore, the 
programmer first prepares a roadmap of the program 
to be written, before actually writing the code. Without 
The origin of the term 
Algorithm is traced to 
Persian astronomer and 
mathematician, Abu 
Abdullah Muhammad 
ibn Musa Al-Khwarizmi 
(c. 850 AD) as the 
Latin translation of Al-
Khwarizmi was called 
‘Algorithmi’.
Activity 4.1
What sequence of 
steps will you follow to 
compute the LCM of 
two numbers? 
Ch 4.indd   64 11/10/2021   11:33:50 AM
2024-25
Page 5


“Computer Science is a 
science of abstraction 
-creating the right model for 
a problem and devising the 
appropriate mechanizable 
techniques to solve it.”
–A. Aho and J. Ullman
Chapter 4 
Introduction to 
Problem Solving
In this chapter  
 » Introduction 
 » Steps for Problem 
Solving
 » Algorithm
 » Representation of 
Algorithms
 » Flow of Control
 » Verifying Algorithms
 » Comparison of 
Algorithm
 » Coding
 » Decomposition
4.1 Introduct Ion Today, computers are all around us. We use them 
for doing various tasks in a faster and more accurate 
manner. For example, using a computer or smartphone, 
we can book train tickets online. 
India is a big country and we have an enormous 
railway network. Thus, railway reservation is a complex 
task. Making reservation involves information about 
many aspects, such as details of trains (train type, types 
of berth and compartments in each train, their schedule, 
etc.), simultaneous booking of tickets by multiple users 
and many other related factors.  
It is only due to the use of computers that today, 
the booking of the train tickets has become easy. Online 
booking of train tickets has added to our comfort by 
enabling us to book tickets from anywhere, anytime. 
We usually use the term computerisation to indicate 
the use of computer to develop software in order to 
automate any routine human task efficiently. Computers 
are used for solving various day-to-day problems 
and thus problem solving is an essential skill that a 
computer science student should know. It is pertinent 
to mention that computers themselves cannot solve a 
problem. Precise step-by-step instructions should be 
given by us to solve the problem. Thus, the success of a 
computer in solving a problem depends on how correctly 
and precisely we define the problem, design a solution 
(algorithm) and implement the solution (program) using 
a programming language. Thus, problem solving is the 
process of identifying a problem, developing an algorithm 
for the identified problem and finally implementing the 
algorithm to develop a computer program.
Ch 4.indd   61 21-May-19   11:45:27 AM
2024-25
Computer SCien Ce – Cla SS xi 62
4.2 Step S for p roblem Solv Ing Suppose while driving, a vehicle starts making a strange 
noise. We might not know how to solve the problem 
right away. First, we need to identify from where the 
noise is coming? In case the problem cannot be solved 
by us, then we need to take the vehicle to a mechanic. 
The mechanic will analyse the problem to identify the 
source of the noise, make a plan about the work to be 
done and finally repair the vehicle in order to remove 
the noise. From the above example, it is explicit that, 
finding the solution to a problem might consist 
of multiple steps. 
When problems are straightforward and easy, 
we can easily find the solution. But a complex 
problem requires a methodical approach to 
find the right solution. In other words, we have 
to apply problem solving techniques. Problem 
solving begins with the precise identification of 
the problem and ends with a complete working 
solution in terms of a program or software. 
Key steps required for solving a problem using 
a computer are shown in Figure 4.1 and are 
discussed in following subsections.
4.2.1 Analysing the problem
It is important to clearly understand a problem before 
we begin to find the solution for it. If we are not clear 
as to what is to be solved, we may end up developing 
a program which may not solve our purpose. Thus, 
we need to read and analyse the problem statement 
carefully in order to list the principal components of 
the problem and decide the core functionalities that 
our solution should have. By analysing a problem, we 
would be able to figure out what are the inputs that 
our program should accept and the outputs that it  
should produce. 
4.2.2 Developing an Algorithm 
It is essential to device a solution before writing a program 
code for a given problem. The solution is represented in 
natural language and is called an algorithm. We can 
imagine an algorithm like a very well-written recipe for 
GIGO (Garbage In Garbage 
Out)
The correctness of the 
output that a computer 
gives depends upon the 
correctness of input 
provided.
Figure 4.1: Steps for problem solving
Algorithm
A set of exact steps 
which when followed, 
solve the problem 
or accomplish the 
required task. 
Ch 4.indd   62 08-Apr-19   12:34:19 PM
2024-25
Introduct Ion to Problem Solv Ing 63
a dish, with clearly defined steps that, if followed, one 
will end up preparing the dish.
We start with a tentative solution plan and keep 
on refining the algorithm until the algorithm is able 
to capture all the aspects of the desired solution. For 
a given problem, more than one algorithm is possible 
and we have to select the most suitable solution. The 
algorithm is discussed in section 4.3.
4.2.3 Coding
After finalising the algorithm, we need to convert the 
algorithm into the format which can be understood by 
the computer to generate the desired solution. Different 
high level programming languages can be used for 
writing a program. 
It is equally important to record the details of the 
coding procedures followed and document the solution. 
This is helpful when revisiting the programs at a later 
stage. Coding is explained in detail in section 4.8.
4.2.4 Testing and Debugging
The program created should be tested on various 
parameters. The program should meet the requirements 
of the user. It must respond within the expected time. It 
should generate correct output for all possible inputs. 
In the presence of syntactical errors, no output will be 
obtained. In case the output generated is incorrect, then 
the program should be checked for logical errors, if any.
Software industry follows standardised testing 
methods like unit or component testing, integration 
testing, system testing, and acceptance testing while 
developing complex applications. This is to ensure 
that the software meets all the business and technical 
requirements and works as expected. The errors or 
defects found in the testing phases are debugged or 
rectified and the program is again tested. This continues 
till all the errors are removed from the program.
Once the software application has been developed, 
tested and delivered to the user, still problems in terms 
of functioning can come up and need to be resolved 
from time to time. The maintenance of the solution, 
thus, involves fixing the problems faced by the user, 
n ote S
Ch 4.indd   63 08-Apr-19   12:34:19 PM
2024-25
Computer SCien Ce – Cla SS xi 64
answering the queries of the user and even serving the 
request for addition or modification of features.
4.3 Algorithm In our day-to-day life we perform activities by following 
certain sequence of steps. Examples of activities include 
getting ready for school, making breakfast, riding a 
bicycle, wearing a tie, solving a puzzle and so on. To 
complete each activity, we follow a sequence of steps. 
Suppose following are the steps required for an activity 
‘riding a bicycle’: 
1) remove the bicycle from the stand,
2) sit on the seat of the bicycle, 
3) start peddling,
4) use breaks whenever needed and
5) stop on reaching the destination.
Let us now find Greatest Common Divisor (GCD) of two 
numbers 45 and 54.
Note: GCD is the largest number that divides both the  
given numbers.
Step 1: Find the numbers (divisors) which can divide the 
given numbers
 Divisors of 45 are: 1, 3, 5, 9, 15, and 45
 Divisors of 54 are: 1, 2, 3, 6, 9, 18, 27,  
 and 54
Step 2: Then find the l argest common number from these 
two lists.
  Therefore, GCD of 45 and 54 is 9 
Hence, it is clear that we need to follow a sequence 
of steps to accomplish the task. Such a finite sequence 
of steps required to get the desired output is called  
an algorithm. It will lead to the desired result in a finite 
amount of time, if followed correctly. Algorithm has a 
definite beginning and a definite end, and consists of a 
finite number of steps.
4.3.1 Why do we need an Algorithm?
A programmer writes a program to instruct the computer 
to do certain tasks as desired. The computer then follows 
the steps written in the program code. Therefore, the 
programmer first prepares a roadmap of the program 
to be written, before actually writing the code. Without 
The origin of the term 
Algorithm is traced to 
Persian astronomer and 
mathematician, Abu 
Abdullah Muhammad 
ibn Musa Al-Khwarizmi 
(c. 850 AD) as the 
Latin translation of Al-
Khwarizmi was called 
‘Algorithmi’.
Activity 4.1
What sequence of 
steps will you follow to 
compute the LCM of 
two numbers? 
Ch 4.indd   64 11/10/2021   11:33:50 AM
2024-25
Introduct Ion to Problem Solv Ing 65
a roadmap, the programmer may not be able to clearly 
visualise the instructions to be written and may end up 
developing a program which may not work as expected.
Such a roadmap is nothing but the algorithm which is 
the building block of a computer program. For example, 
searching using a search engine, sending a message, 
finding a word in a document, booking a taxi through 
an app, performing online banking, playing computer 
games, all are based on algorithms.
Writing an algorithm is mostly considered as a first 
step to programming. Once we have an algorithm to 
solve a problem, we can write the computer program 
for giving instructions to the computer in high level 
language. If the algorithm is correct, computer will run 
the program correctly, every time. So, the purpose of 
using an algorithm is to increase the reliability, accuracy 
and efficiency of obtaining solutions. 
(A) Characteristics of a good algorithm 
• Precision — the steps are precisely stated or defined.
• Uniqueness — results of each step are uniquely 
defined and only depend on the input and the result 
of the preceding steps.
• Finiteness — the algorithm always stops after a 
finite number of steps.
• Input — the algorithm receives some input.
• Output — the algorithm produces some output.
(B) While writing an algorithm, it is required to   
 clearly identify the following:
• The input to be taken from the user
• Processing or computation to be performed to get 
the desired result
• The output desired by the user
4.4 r epre Sent At Ion of Algor Ithm S
Using their algorithmic thinking skills, the software 
designers or programmers analyse the problem and 
identify the logical steps that need to be followed to reach 
a solution. Once the steps are identified, the need is to 
n ote S
Ch 4.indd   65 08-Apr-19   12:34:19 PM
2024-25
Read More
33 docs|11 tests
Related Searches

practice quizzes

,

Objective type Questions

,

Previous Year Questions with Solutions

,

past year papers

,

MCQs

,

NCERT Textbook: Introduction to Problem Solving | Computer Science for Class 11 - Humanities/Arts

,

NCERT Textbook: Introduction to Problem Solving | Computer Science for Class 11 - Humanities/Arts

,

Free

,

shortcuts and tricks

,

Exam

,

video lectures

,

study material

,

Viva Questions

,

Summary

,

Important questions

,

NCERT Textbook: Introduction to Problem Solving | Computer Science for Class 11 - Humanities/Arts

,

Extra Questions

,

ppt

,

Sample Paper

,

mock tests for examination

,

Semester Notes

,

pdf

;