INTRODUCTION TO PROBLEM SOLVING
What is a Problem?
A problem is a situation or task that requires a
solution. In computer science, a problem is solved
by writing a sequence of instructions that the
computer can understand and execute.
Examples:
Finding the average marks of students.
Calculating the area of a circle.
Sorting names alphabetically.
Finding the largest number among three
numbers.
What is Problem Solving?
Problem solving is the process of understanding a
problem, planning a solution, implementing it, and
checking whether the solution works correctly. It
is one of the most important skills in computer
programming.
What is an Algorithm?
An algorithm is a finite sequence of well-defined
instructions used to solve a problem. An algorithm
is a step-by-step procedure for solving a problem
in a finite amount of time.
Advantages of Algorithms
Easy to understand
Helps detect logical errors
Independent of programming language
Makes coding easier
Easy to modify
Improves efficiency
Disadvantages of Algorithms
Time-consuming for complex problems
Difficult for very large programs
No standard notation
INTRODUCTION TO PROBLEM SOLVING
Break the problem into smaller parts.
Determine the logic, formulas, or methods
required.
Plan how the input will be transformed
into the desired output.
3. Designing the Solution
Develop a step-by-step solution.
Prepare an algorithm, flowchart, or
pseudocode before coding.
4. Implementing the Solution
Convert the algorithm into a program
using a programming language (such as
Python).
Write the program according to the
planned logic.
5. Testing the Solution
Execute the program with different test
cases.
Verify that the output is correct for all
valid inputs.
Check boundary and invalid input cases.
6. Debugging and Improving
Identify and correct errors (syntax, logical,
or runtime errors).
Improve the program for better efficiency,
Stages of the Problem Solving Cycle readability, and performance.
The Problem Solving Cycle is a systematic
process used to understand a problem, develop a
solution, and verify that the solution works
correctly.
1. Understanding the Problem
Read the problem carefully.
Identify the inputs, outputs, and objectives.
Understand any conditions or constraints.
2. Analyzing the Problem