PROBLEM SOLVING
Module 1: Foundations of Problem Solving
Unit 2: Steps in Problem Solving
BY
DR. JOHNWENDY C.N.
DEPARTMENT OF COMPUTER SCIENCE
NILE UNIVERSITY OF NIGERIA
4/14/2026 1
OBJECTIVES
• To understand Problem analysis
• To understand Solution design
• To understand Implementation
• To understand Testing and debugging
4/14/2026 2
INTRODUCTION
In life, whenever we face a problem, we usually follow certain steps to
solve it, even if we don’t realize it.
For example:
You are hungry.
What do you do?
You realize you are hungry.
You think about what food is available.
You decide what to eat.
You cook or buy the food.
You taste it to see if it is good.
This is already a problem-solving process.
4/14/2026 3
SIX STEPS OF PROBLEM SOLVING
Problem Definition
Problem Analysis
Solution Design (Algorithm)
Implementation
Testing and Debugging
Evaluation / Documentation
4/14/2026 4
STEP 1: PROBLEM DEFINITION
This means clearly understanding what the problem is.
You must ask:
What is the problem?
What do I want to achieve?
What is the goal?
Example
Problem: A student wants to calculate their average score in 5 courses.
Goal: Find the average score.
If the problem is not clearly understood, the solution will be wrong.
That is why problem definition is very important.
4/14/2026 5
STEP 2: PROBLEM ANALYSIS
After understanding the problem, Example
the next step is to study the Problem: Calculate average score of 5
problem carefully. courses.
You identify: Inputs:
Score1
Inputs (what information is Score2
needed) Score3
Score4
Outputs (what result you want) Score5
Conditions or rules Output:
Average score
Rule:
Average = Sum of scores ÷ number of
scores
4/14/2026 6
STEP 3: SOLUTION DESIGN
Now we plan the solution step by step.
These steps are called an algorithm.
An algorithm is simply a set of instructions to solve a problem.
Example Algorithm
Find average of 5 numbers:
Start
Input five scores
Add all the scores
Divide the sum by 5
Display the result
Stop
This is the plan for solving the problem.
4/14/2026 7
STEP 4: IMPLEMENTATION
Implementation means putting the solution into action.
In computing, this usually means writing a program.
Example:
The algorithm we wrote can now be written in a programming language like
Python or Java or any other Programming Language.
But implementation can also be manual.
Example:
A teacher calculating average using a calculator.
4/14/2026 8
STEP 5: TESTING AND DEBUGGING
After creating the solution, we must check if it works correctly.
This is called testing.
If we find mistakes, we correct them. That is called debugging.
Example
Test the average program using:
Scores: 60, 70, 80, 90, 100
Expected result:
Average = 80
If the program gives a wrong result, we find and fix the error.
4/14/2026 9
STEP 6: EVALUATION AND
DOCUMENTATION
Finally, we ask:
Did the solution work well?
Can it be improved?
Can others understand it?
Documentation means writing explanations about the solution so that
other people can understand it later.
Example:
Describe the algorithm
Explain the inputs and outputs
Explain how the program works
4/14/2026 10
REAL LIFE EXAMPLE
• Problem: Preparing Rice
• Define problem → Need cooked rice
• Analyze → Rice, water, pot, stove
• Design solution → Steps to cook rice
• Implement → Cook the rice
• Test → Taste rice
• Evaluate → Adjust salt or water next time
4/14/2026 11
REAL WORLD EXERCISES
Exercise 1: Late to Class Problem
A student often arrives late to morning lectures.
Tasks
Define the problem clearly.
Analyze the possible causes of the problem.
Design a step-by-step solution to solve it.
Explain how the solution will be implemented.
Describe how you would test whether the solution works.
4/14/2026 12
REAL WORLD EXERCISES
Exercise 2: Phone Battery Draining Quickly
Your phone battery does not last throughout the day.
Tasks
Define the problem.
Identify the inputs and possible causes.
Design a solution strategy.
Suggest how the solution can be implemented.
Explain how you will test if the solution solved the problem.
4/14/2026 13
REAL WORLD EXERCISES
Exercise 3: Calculating Student Average Score
A lecturer wants to calculate the average score of 10 students.
Tasks
Define the problem.
Identify:
Inputs
Outputs
Design an algorithm for calculating the average.
Explain how it can be implemented using a computer.
4/14/2026 14
REAL WORLD EXERCISES
Exercise 4: Choosing the Best Internet Provider
A student wants to choose the best internet provider based on:
Price
Speed
Reliability
Tasks
Define the decision problem.
Analyze the factors involved.
Design a method for comparing providers.
Explain how the student can test the decision.
4/14/2026 15
REAL WORLD EXERCISES
Exercise 5: Organizing Study Time
A student has 5 courses and finds it difficult to manage study time.
Tasks
Define the time-management problem.
Analyze the constraints.
Design a structured study plan.
Explain how the plan will be implemented.
Describe how the student will evaluate if the plan works.
4/14/2026 16
REAL WORLD EXERCISES
Exercise 7: Traffic Congestion
There is serious traffic congestion at the university gate every morning.
Tasks
Define the problem.
Analyze possible causes.
Design a systematic solution.
Explain how the solution can be implemented.
Suggest how to evaluate whether traffic has improved.
4/14/2026 17
COMPUTATIONAL EXERCISE
Exercise 8: Calculating Electricity Bill
An electricity company charges:
First 100 units → $0.50 per unit
Next 100 units → $0.75 per unit
Above 200 units → $1.00 per unit
Tasks
Define the problem.
Identify inputs and outputs.
Design a step-by-step algorithm to compute the bill.
4/14/2026 18
CRITICAL THINKING EXERCISE
Exercise 9: Lost Student Records
A university department lost some student records due to a computer error.
Tasks
Define the problem clearly.
Analyze the risks and consequences.
Design a recovery strategy.
Suggest preventive measures.
4/14/2026 19
REAL WORLD PROBLEMS
Exercise 10: Online Examination System Failure
During an online exam, the system suddenly crashes.
Tasks
Define the problem.
Analyze possible causes.
Design a recovery procedure.
Suggest how to test the system to avoid future failures.
4/14/2026 20