COS 121 PROBLEM SOLVING
Module 1: Foundations of Computing and Problem-Solving
Learning Outcomes:
At the end of this lecture, students should be able to:
Understand what computing is and how it works
Explain the core concepts of computing
Distinguish between a problem and a task
Explain the importance of problem-solving in computing
Identify real-world problems that require computational solutions
1. Introduction to Computing
Computing refers to the process of using computers and computational systems to process data,
perform calculations, and solve problems.
Computing is about:
1. Taking input (data)
2. Processing it using rules or programs
3. Producing output (information)
Examples
ATM machines processing withdrawals
Mobile apps calculating results
School systems managing student records
Key Elements of Computing
Input → Data entered into the system
Processing → Operations performed on data
Output → Results produced
Storage → Saving data for future use
How Computing Works
A user enters data (e.g., exam scores)
The system processes the data (calculates average)
The system produces output (final result)
The result is stored for later use
2. Core Concepts of Computing
Definition of Computing Concepts
1. Data Processing: Transforming raw data into meaningful information. Example: Scores → Average →
Grade
2. Automation: Using computers to perform tasks automatically without human intervention. Example:
Payroll systems calculating salaries automatically
3. Algorithms:- A step-by-step procedure for solving a problem. Example: Steps to calculate the sum of
two numbers
Components of a Computing System
A computing system consists of:
1. Hardware:- Physical parts of a computer. Examples: keyboard, monitor, CPU
2. Software:- Programs that run on the computer. Examples: operating systems, applications
3. Data:- Raw facts and figures processed by the computer. Example: student scores
4. Users (Peopleware):- People who interact with the system.📌 Examples: students, teachers,
programmers
Interaction in a Computing System
User inputs data using hardware
Software processes the data
Output is displayed through hardware
Data is stored for future use
3. Meaning of a Problem
A problem is a situation that requires a solution or a task that needs to be completed but does not have
an immediate answer. Examples of Problems:
Calculating students’ results
Finding the shortest route to school
Detecting fraud in banking systems
Problem vs Task
Feature Problem Task
Definition Requires thinking to find a solution A defined piece of work
Complexity Often complex Usually simple
Example How to sort data efficiently Entering data into a system
Identifying a Problem
Recognize a need or difficulty
Clearly define the issue
Determine inputs and expected outputs
Identify constraints
4. What is Problem-Solving?
Problem-solving is the process of identifying, analyzing, and finding solutions to problems using logical
and systematic steps.
Why Problem-Solving is Important in Computing
Helps design efficient programs
Enables automation of real-world tasks
Improves decision-making
Reduces errors and inefficiencies
General Problem-Solving Steps
Step 1: Understand the Problem: What is required? What are the inputs and outputs?
Step 2: Analyze the Problem: Break it into smaller parts. Identify patterns
Step 3: Design a Solution: Use algorithms or flowcharts
Step 4: Implement the Solution: Write the program/code
Step 5: Test and Evaluate: Check correctness, Fix errors
Step 6: Refine the Solution: Improve efficiency. Optimize performance
5. Importance of Problem-Solving in Computing
1. Foundation of Programming - Every program solves a problem
2. Real-World Applications - Banking systems, Healthcare systems, &Transportation systems
3. Efficiency and Optimization: Better solutions save time and resources
4. Innovation. New technologies are built by solving problems
Real-Life Examples (Contextualized)
Traffic management systems in Lagos
Online payment platforms
Student result processing systems
6. Identifying Real-World Problems for Computing Solutions
Step 1: Observe the Environment; Look for inefficiencies or challenges
Step 2: Define the Problem Clearly: What exactly needs to be solved?
Step 3: Determine Data Needed: What inputs are required?
Step 4: Consider Possible Solutions: Can a computer solve this problem?
Step 5: Evaluate Feasibility: Is it practical and efficient?
Examples
Problem Computing Solution
Manual attendance tracking Attendance management system
Long queues in banks ATM and online banking
Exam result errors Automated grading system
Summary
Computing is the use of computers to process data and solve problems
Core concepts include data processing, automation, and algorithms
A problem requires thinking, while a task is a defined action
Problem-solving is central to computing and programming
Real-world challenges can be solved using computational methods
Module 2: Understanding Problems
Learning Outcomes
At the end of this lecture, students should be able to:
Identify and define problems correctly
Classify problems into appropriate categories
Distinguish between routine and non-routine problems
Analyze problem characteristics (well-defined vs ill-defined)
Develop analytical thinking skills for computing
1. Identification of Problems
Problem identification is the process of recognizing and clearly defining a situation that requires a
solution.
In computing, this is the first and most critical step, because: A wrongly defined problem leads to a
wrong solution.
Steps in Identifying a Problem
Step 1: Recognize the Need: What is not working? What needs improvement?
Example: Students’ results are calculated manually and often contain errors.
Step 2: Define the Problem Clearly: State the problem in simple, precise terms
Example: “How can we automate student result computation to reduce errors?”
Step 3: Identify Inputs and Outputs:
Inputs → What data is needed?
Outputs → What results are expected?
Example:
Input: scores
Output: total, average, grade
Step 4: Identify Constraints: Time, cost, tools, or limitations
Example: Limited access to computers in a school
2. Types of Problems
A. Routine Problems
Routine problems are problems that follow known procedures or standard methods to solve.
Characteristics
Predictable. Repetitive. Easy to solve. Requires little creativity
Examples (Computing Context)
Calculating the sum of numbers
Sorting a list using a known algorithm
Converting temperature from Celsius to Fahrenheit
Example with Steps
Problem: Find the average of 5 numbers
Solution Steps:
Add all numbers
Divide by 5
➡️This is routine because the method is already known.
B. Non-Routine Problems
Non-routine problems are problems that do not have a direct or known solution and require creativity
and deeper thinking.
🔑 Characteristics
Complex
Requires reasoning
Multiple possible solutions
No fixed procedure
📍 Examples (Computing Context)
Designing a fraud detection system
Developing a smart traffic system for Lagos
Building a recommendation system
🧠 Example
Problem: Design a system to predict student performance.
➡️Requires:
Data analysis
Model selection
Testing different approaches
⚖️Comparison: Routine vs Non-Routine Problems
Feature. Routine. Non-Routine
Method. Known. Unknown
Complexity. Low. High
Creativity. Low. High
Example. Calculate sum. Build AI system
3. Problem Characteristics
A. Well-Defined Problems: Problems with clear inputs, processes, and expected outputs.
🔑 Features
Clearly stated
Structured
Easy to analyze
📍 Examples
Calculate student GPA
Find the largest number in a list
B. Ill-Defined Problems: Problems that are unclear, ambiguous, or lack complete information.
🔑 Features
No clear solution path
Multiple interpretations
Requires assumptions
📍 Examples
Improve student performance
Reduce traffic congestion in Lagos
⚖️Comparison: Well-Defined vs Ill-Defined
Feature. Well-Defined. Ill-Defined
Clarity. High. Low
Solution Path. Clear. Unclear
Example. Calculate average. Improve education system
4. Developing Analytical Thinking
The ability to break down problems into smaller parts and solve them logically.
🧠 Steps to Develop Analytical Thinking
Step 1: Break the Problem Down: Divide into smaller sub-problems
Step 2: Identify Patterns: Look for similarities
Step 3: Establish Relationships: How do parts connect?
Step 4: Formulate Solutions: Propose logical steps
Step 5: Evaluate Results: Check correctness
📌 Example
Problem: Calculate class result
Breakdown:
Input scores. Compute total. Compute average. Assign grade
🔷 5. Practical Examples (Real-World Context)
🏫 Example 1: School System
Problem: Manual result errors
Type: Routine
Solution: Automated grading system
🚦 Example 2: Traffic Control
Problem: Traffic congestion
Type: Non-routine
Solution: Smart traffic system
💳 Example 3: Banking Fraud Detection
Problem: Fraud detection
Type: Non-routine
Requires AI/ML
🔷 Summary
Problem identification is the first step in problem-solving
Problems are classified into:
Routine (simple, predictable)
Non-routine (complex, creative)
Problems can also be:
Well-defined (clear)
Ill-defined (ambiguous)
Analytical thinking helps break down and solve problems effectively
Module 3: Methods of Solving Computing Problems
🎯 Learning Outcomes
At the end of this lecture, students should be able to:
Explain what an algorithm is
Identify and explain properties of algorithms
Understand heuristic approaches to problem-solving
Differentiate between algorithmic and heuristic methods
Design simple algorithms for computational problems
1. Introduction to Algorithms
An algorithm is a finite, step-by-step procedure used to solve a specific problem or perform a task.
An algorithm is like a recipe: Clearly defined steps. Followed in order. Leads to a desired result
Real-Life Examples
Steps to cook rice
Procedure to withdraw money from an ATM
Instructions to calculate a student’s average score
Example: Simple Algorithm
Problem: Find the sum of two numbers
Algorithm Steps:
Start
Input two numbers (A and B)
Compute Sum = A + B
Display Sum
Stop
🔄 Algorithm in Computing Context - In programming:
Algorithms are translated into code
They form the logic behind programs
2. Properties of a Good Algorithm
A good algorithm must satisfy the following properties:
1. Finiteness:_ The algorithm must terminate after a finite number of steps
📌 Example:
A loop that runs forever ❌ (Not valid)
A loop that runs 10 times ✅
2. Definiteness:- Each step must be clear and unambiguous
📌 Example:
“Add 2 to the number” ✅
“Process the number somehow” ❌
✅ 3. Input:- The algorithm must have zero or more inputs
📌 Example: Input: student scores
✅ 4. Output:- The algorithm must produce at least one output
📌 Example: Output: average score
✅ 5. Effectiveness:- Steps must be simple, feasible, and executable
📌 Example: “Divide number by 2” ✅
“Guess the correct answer magically” ❌
🧠 Illustrative Example
Problem: Find the largest of two numbers
Algorithm:
Start
Input A and B
If A > B, display A
Else display B
Stop
✔ Finiteness → Ends
✔ Definiteness → Clear steps
✔ Input → A, B
✔ Output → Largest number
✔ Effectiveness → Simple comparison
🔷 3. Designing Algorithms
🧠 Step-by-Step Approach
Step 1: Understand the Problem:What is required?
Step 2: Identify Inputs and Outputs
Inputs → Data needed
Outputs → Expected result
Step 3: Break Down the Problem:-Divide into smaller steps
Step 4: Write the Algorithm:- Use simple, clear instructions
Step 5: Test the Algorithm:- Use sample data
📌 Example: Algorithm to Calculate Average
Start
Input three numbers A, B, C
Compute Sum = A + B + C
Compute Average = Sum / 3
Display Average
Stop
🔷 4. Introduction to Heuristics
Heuristics are problem-solving strategies or “rules of thumb” used to find quick, approximate solutions.
Heuristics prioritize speed over perfection.
🔑 Characteristics of Heuristics
Faster than algorithms
Not always accurate
Useful for complex problems
Based on experience or intuition
📍 Examples
Searching for a name by scanning likely positions first
Guessing answers in a multiple-choice test
Using shortcuts in route navigation (e.g., avoiding traffic areas)
🧠 Example in Computing
Problem: Find a file in a large system
Algorithm approach: Search every file (accurate but slow)
Heuristic approach: Search likely folders first (faster but not guaranteed)
🔷 5. Algorithm vs Heuristic
Feature. Algorithm. Heuristic
Accuracy. Exact. Approximate
Speed. Slower. Faster
Reliability. High. Moderate
Use Case. Well-defined problems. Complex problems
🧠 Illustration
Problem: Finding shortest route
Algorithm: Dijkstra’s algorithm (exact shortest path)
Heuristic: Choose routes based on experience (faster guess)
🔷 6. When to Use Algorithms vs Heuristics
Use Algorithms When:
Accuracy is critical
Problem is well-defined
Solution must be reliable
📌 Example: Banking calculations. Medical systems
✅ Use Heuristics When:
Problem is complex
Time is limited
Approximate solution is acceptable
📌 Example: AI decision-making. Game strategies
🔷. Summary
An algorithm is a step-by-step procedure for solving problems
Good algorithms must be:
Finite. Definite. Have input/output. Effective
Heuristics are quick, approximate methods
Algorithms are best for accuracy, heuristics for speed
Both are essential in computing and real-world problem-solving