Computer Science

Introduction to Problem Solving Class 11 CBSE Computer Science: Steps of Problem Solving, Algorithm, Flowchart, Pseudocode and Decomposition

Class 11 · Computer Science

Introduction to Problem Solving (CBSE Class 11 Computer Science)

Programming is not just about writing code. Before writing a program, a programmer must understand the problem, design a solution, and then convert that solution into a programming language. This systematic approach is known as Problem Solving.

Learning Objectives

  • Understand problem solving.
  • Learn the steps involved in problem solving.
  • Understand algorithms.
  • Learn pseudocode.
  • Understand flowcharts.
  • Learn decomposition.

What is Problem Solving?

Problem Solving is a systematic process of identifying a problem, analyzing it, designing a solution, implementing it, and verifying that the solution works correctly.

Definition: Problem Solving is the process of finding an efficient and logical solution to a given problem.

Why is Problem Solving Important?

  • Helps understand the problem clearly.
  • Produces efficient programs.
  • Reduces programming errors.
  • Makes debugging easier.
  • Improves logical thinking.

Steps of Problem Solving


Problem
   │
   ▼
Analyze the Problem
   │
   ▼
Develop Algorithm
   │
   ▼
Draw Flowchart / Write Pseudocode
   │
   ▼
Coding
   │
   ▼
Testing
   │
   ▼
Debugging
   │
   ▼
Final Solution

Step 1: Analyzing the Problem

The first step is to understand the problem completely. The programmer identifies:

  • What is the problem?
  • What input is required?
  • What output is expected?
  • What processing is needed?

Example

Problem: Find the area of a rectangle.

Input Process Output
Length, Breadth Area = Length × Breadth Area of Rectangle

Step 2: Developing an Algorithm

An Algorithm is a finite sequence of well-defined steps to solve a problem.

Definition: An Algorithm is a step-by-step procedure to solve a problem in a finite number of steps.

Characteristics of an Algorithm

  • Clearly defined steps.
  • Finite number of steps.
  • Produces the correct output.
  • Easy to understand.

Example Algorithm

Problem: Calculate the area of a rectangle.


Step 1 : Start

Step 2 : Input Length and Breadth

Step 3 : Area = Length × Breadth

Step 4 : Display Area

Step 5 : Stop

Step 3: Flowchart

A Flowchart is a graphical representation of an algorithm using standard symbols.

Common Flowchart Symbols

Symbol Name Purpose
Oval Terminal Start/Stop
Rectangle Process Calculation
Parallelogram Input/Output Read/Display Data
Diamond Decision Condition Checking
Arrow Flow Line Direction of Flow

Flowchart Example


 ┌───────┐
 │ Start │
 └───┬───┘
     │
     ▼
┌───────────────┐
│Input L and B  │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│Area = L × B   │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│Display Area   │
└──────┬────────┘
       │
       ▼
 ┌───────┐
 │ Stop  │
 └───────┘

Advantages of Flowcharts

  • Easy to understand.
  • Helps identify logical errors.
  • Improves communication.
  • Acts as documentation.

Step 4: Pseudocode

Pseudocode is an informal way of writing the logic of a program using simple English statements.

It is independent of any programming language.


Pseudocode Example


BEGIN

INPUT Length

INPUT Breadth

Area ← Length × Breadth

PRINT Area

END

Advantages of Pseudocode

  • Easy to write.
  • Easy to understand.
  • Language independent.
  • Easy to convert into a program.

Algorithm vs Flowchart vs Pseudocode

Algorithm Flowchart Pseudocode
Written steps. Graphical representation. English-like statements.
Easy to write. Easy to visualize. Easy to convert into code.
Uses numbered steps. Uses symbols. Uses simple English.

Step 5: Coding

Coding is the process of writing the solution in a programming language such as Python.

Python Example


length = float(input("Enter Length: "))

breadth = float(input("Enter Breadth: "))

area = length * breadth

print("Area =", area)

Step 6: Testing

Testing checks whether the program produces the expected output for different inputs.

Input Expected Output
Length = 5, Breadth = 4 20
Length = 10, Breadth = 2 20

Step 7: Debugging

Debugging is the process of identifying and correcting errors in a program.

Types of Errors

  • Syntax Errors
  • Logical Errors
  • Run-time Errors

These errors will be discussed in detail later in this unit.


Decomposition

Decomposition is the process of breaking a large problem into smaller and manageable sub-problems.

Definition: Decomposition is the technique of dividing a complex problem into smaller, easier-to-solve parts.

Example

School Management System


School Management

      │

      ├── Student Module

      ├── Teacher Module

      ├── Examination Module

      ├── Fee Module

      └── Library Module

Each module can be developed independently, making the overall system easier to design and maintain.


Real-Life Example

Suppose you are organizing the school's Annual Function.

  • Stage Decoration
  • Invitation
  • Sound System
  • Photography
  • Student Performances
  • Refreshments

Instead of handling everything at once, the event is divided into smaller tasks. This is an example of Decomposition.


Think Like a Programmer

Before writing a program, every programmer should identify three important components:

  • Input – What data will be provided?
  • Process – What calculations or decisions will be performed?
  • Output – What result should be displayed?

Let's practice computational thinking using some real-life examples.


Situation 1: Area of a Rectangle

Component Description
Input Length, Breadth
Process Area = Length × Breadth
Output Area of Rectangle

Situation 2: Student Result

Component Description
Input Marks of five subjects
Process Calculate Total, Percentage and Grade
Output Total Marks, Percentage and Grade

Situation 3: Even or Odd Number

Component Description
Input One Integer
Process Check Number % 2
Output Even or Odd

Situation 4: Electricity Bill

Component Description
Input Units Consumed
Process Calculate Bill according to tariff
Output Total Electricity Bill

Situation 5: Largest of Three Numbers

Component Description
Input Three Numbers
Process Compare the numbers
Output Largest Number

Programming Tip

Whenever you solve a programming problem, never start writing Python code immediately. Always follow this sequence:


Input
   ↓
Process
   ↓
Output
   ↓
Algorithm
   ↓
Flowchart
   ↓
Python Program

Following this approach helps reduce logical errors and makes programs easier to understand and debug.


Practice Yourself

Identify the Input, Process, and Output for each of the following situations:

  1. Calculate the Simple Interest.
  2. Find the Average of five numbers.
  3. Check whether a person is eligible to vote.
  4. Convert temperature from Celsius to Fahrenheit.
  5. Calculate the area of a circle.
  6. Display the multiplication table of a number.
  7. Calculate the salary of an employee after adding HRA and DA.
  8. Find the greatest among four numbers.
Challenge Activity: Choose any one of the above problems and write:
  • Algorithm
  • Flowchart
  • Pseudocode
before writing the Python program.

Common Errors

  • Writing code without understanding the problem.
  • Skipping the algorithm.
  • Confusing algorithms with flowcharts.
  • Ignoring testing after coding.
  • Trying to solve a large problem without decomposition.

Exam Tips

  • Remember all seven steps of problem solving.
  • Know the standard flowchart symbols.
  • Practice writing simple algorithms.
  • Differentiate between Algorithm, Flowchart and Pseudocode.
  • Understand the importance of decomposition.

Frequently Asked Questions (FAQs)

1. What is problem solving?

Problem solving is the systematic process of finding an efficient solution to a given problem.

2. What is an algorithm?

An algorithm is a finite sequence of well-defined steps used to solve a problem.

3. What is the purpose of a flowchart?

A flowchart graphically represents the logic of an algorithm using standard symbols.

4. What is pseudocode?

Pseudocode is an English-like description of an algorithm that is independent of any programming language.

5. What is decomposition?

Decomposition is the process of dividing a complex problem into smaller and manageable sub-problems.


Summary

  • Problem solving is the foundation of programming.
  • The seven steps include Analysis, Algorithm, Flowchart/Pseudocode, Coding, Testing, and Debugging.
  • Algorithms provide step-by-step solutions.
  • Flowcharts visually represent algorithms.
  • Pseudocode uses simple English statements to describe program logic.
  • Decomposition simplifies complex problems by breaking them into smaller tasks.
  • A systematic problem-solving approach leads to efficient and reliable programs.