NAVODAYA VIDYALAYA SAMITI�HYDERABAD REGION
SUBJECT : COMPUTER SCIENCE
CLASS : XI
TOPIC : INTRODUCTION TO PROBLEM SOLVING
SANTOSH KUMAR PGT COMPUTER SCIENCE
JNV DAKSHINA KANNADA, KARNATAKA
What is in This Chapter ?�
What is problem ?
A matter or situation regarded as unwelcome / harmful and need to be dealt with overcome is known as problem.
Regardless of the area of study, computer science is all about solving problems with computers. The problems that we want to solve can come from any real-world problem or perhaps even from the abstract world. We need to have a standard systematic approach to solving problems.
Computer / Microprocessor is the main device nowadays for finding the solution of a problem, because of it’s speed and the way it can deal with data.
Generally problems are solved using some sort of program/software using any computer programming language.
Problem Solving Cycle
Which can be further extended in larger domain
There are 3 basic steps for solving any problem using computer/computer program
1.Analyse/Define problem
2.Design Solution
3.Implement solution
1- Analyze / Define problem�
In almost every problem solving methodology the first step is defining or identifying the problem. It is the most difficult and the most important of all the steps. It involves diagnosing the situation so that the focus on the real problem and not on its symptoms. For example, ‘if performance in any department is substandard, we might think the problem is with the individuals submitting work. However, if we look a bit deeper, the real issue might be a lack of training, or an unreasonable workload’.
As above example, same thing may happen with problem solving using computer program, so before starting designing/coding, problem must be thoroughly defined/analyzed
The process of understanding the problem and then defining it on the basis of following:
Suppose we are assigned to solve an arithmetic problem and we are not familiar with steps involved in solving that problem. In Such a case, we will not be able to solve the problem. The same applied to writing computer programs. A computer programmer cannot write the instructions to be followed by the computer unless he knows how to solve that problem. The first step in application development is problem definition. In addition, a program source data, logical and practical procedures needed to solve the problem. This analysis must taken placed before actual preparation of program development, otherwise it will cause much cost and time.
2- Design Solution��
Design is a process to transform user requirements in to some suitable form, which helps the programmer in software coding and implementation.
Programming tools, program design tools are the tools used to develop a program. Following are some of them
Designing an algorithm��
An algorithm is a plan, a logical step-by-step process for solving a problem. Algorithms are normally written as a flow chart or in pseudo-code as it’s next level.
When designing an algorithm there are two main areas to look at:
An algorithm to Find largest of two numbers :
Step 1: Start
Step 2: Declare variables a, b
Step 3: Read variables a, b
Step 4: If a>b
Display a is the largest number.
Else
Display b is the largest number.
Flow Chart
A flowchart is simply a graphical representation of steps. It shows steps in a sequential order, and is widely used in presenting flow of algorithms, workflow or processes. Typically, flowchart shows the steps as boxes of various kinds, and their order by connecting them with arrows.
Flowchart Symbols
Different flowchart shapes have different conventional meanings. The meanings of some of the more common shapes are as follows:
Flow Chart
1. Terminator
The terminator symbol represents the starting or ending point of the system.�
2. Process
A box indicates some particular operation.�
3. Document
This represents a printout, such as a document or a report.
4. Decision
A diamond represents a decision or branching point. Lines coming out from the diamond indicates different possible situations, leading to different sub-processes.
5. Data
It represents information entering or leaving the system. An input might be an order from a customer. An output can be a product to be delivered.
6. Flow
Lines represent flow of the sequence and direction of a process.
Flow Chart : �Addition of two numbers
Representation of algorithm using flow chart
Finding largest of
two numbers
Pseudo-code
Pseudocode is not a programming language, it is a simple way of describing a set of instructions that does not have to use specific syntax.
There is no strict set of standard notations for pseudocode, but some of the most widely recognized are:
INPUT/READ–indicates a user will be inputting something
OUTPUT/WRITE–indicates that an output will appear on the screen
Pseudo-code
WHILE– a loop (iteration that has a condition at the beginning)
FOR– a counting loop (iteration)
REPEAT–UNTIL– a loop (iteration) that has a condition at the end
IF –THEN –ELSE– a decision (selection) in which a choice is made.
any instructions that occur inside a selection or iteration are usually indented.
Representation of algorithm using Pseudo-code
Example-Pseudo code to find out largest of two numbers
Write "please enter 2 numbers"
Read n1,n2
If(n1 > n2)
Set n1 to max
Else
Set n2 to max
Write “Largest value is”,max
Difference between algorithm and pseudo-code
3. Implementation
Implementation refers to the process of adopting and integrating a software application in to a real environment.
Implementation of new tools and software in to an enterprise can be complex, depending on the size of the organization and the software.
Decomposition
Decomposition also known as factoring, is breaking a complex problem or system into parts that are easier to conceive, understand, program, and maintain.
Need for decomposing a problem
It involves breaking down a complex problem or system in to smaller parts that are more manageable and easier to understand. The smaller parts can then be examined and solved, or designed individually, as they are simpler to work with.
Example of Decomposition
Example of Decomposition
2. LIBRARY MANAGEMENT SYSTEM
Example of Decomposition
3. PAYROLL SYSTEM