An algorithm is a clear, step-by-step set of instructions for solving a problem.
It tells a computer:
-
What to do
-
In what order
-
Under what conditions
Without algorithms, computers cannot function.
πΉ SIMPLE REAL-LIFE EXAMPLESΒ
Example 1: Cooking Posho
Imagine explaining how to cook posho.
Bad instructions:
βCook posho.β
Good algorithm:
-
Boil 2 cups of water.
-
Slowly add 1 cup maize flour while stirring.
-
Continue stirring for 5 minutes.
-
Reduce heat.
-
Cover and cook for 10 minutes.
That is an algorithm.
Example 2: Using Mobile Money
Algorithm for sending money:
-
Dial *165#
-
Select βSend Moneyβ
-
Enter phone number
-
Enter amount
-
Enter PIN
-
Confirm
Every step must be exact.
πΉ WHY ALGORITHMS MATTER IN CODING
Computers do NOT think like humans.
They do NOT guess.
They follow instructions exactly.
If you forget a step, the computer fails.
If you are unclear, the computer behaves incorrectly.
In app development:
Algorithms control:
-
Login systems
-
Score calculations
-
Data sorting
-
AI predictions
-
Decision making
πΉ WHAT HAPPENS WITHOUT CLEAR ALGORITHMS?
Imagine building a school attendance app.
If you write:
βWhen student presses button, mark present.β
But you do not define:
-
Which student?
-
Which date?
-
What if pressed twice?
The app will behave incorrectly.
That is why algorithms must be:
β Clear
β Ordered
β Precise
β Complete
πΉ ALGORITHMS IN AI
AI systems also follow algorithms.
For example:
Crop Disease Detection App:
Algorithm might be:
-
Capture image.
-
Preprocess image.
-
Compare image to trained model.
-
Predict disease type.
-
Display treatment advice.
Even AI runs on algorithms.
πΉ ACTIVITY 1: HUMAN ROBOT GAME (Classroom Activity)
One student becomes a βrobot.β
The robot can only do exactly what is said.
Task: Arrange chairs in a row.
Students must give step-by-step instructions.
If they say:
βMove chair.β
Robot asks:
βHow far?β
βWhich direction?β
βWhich chair?β
Lesson:
Be specific.
πΉ ACTIVITY 2: DRAWING ALGORITHM
Students give instructions to draw:
A simple house.
Instructions must include:
-
Draw square
-
Draw triangle roof
-
Add door
-
Add windows
Swap instructions with another team.
If drawing is wrong β Algorithm was unclear.
πΉ ACTIVITY 3: WRITE AN APP ALGORITHM
Scenario:
You are building a simple quiz app.
Write the algorithm for:
When user answers a question.
Example:
-
Display question.
-
Wait for user selection.
-
If answer is correct β Add 1 to score.
-
If incorrect β Show correct answer.
-
Move to next question.
πΉ REFLECTION QUESTIONS
-
Did you realize how detailed instructions must be?
-
Where were your instructions unclear?
-
How does this relate to coding?
-
How will this help your app development?
πΉ KEY TERMS
Algorithm β Step-by-step instructions
Condition β A decision (if/else)
Sequence β Order of steps
Logic β The reasoning behind steps
πΉ ADVANCED EXTENSION (For Strong Teams)
Introduce Flowcharts.
Example:
Start β Input β Decision β Output β End
Teach students:
-
Sequence
-
Selection (If/Else)
-
Iteration (Loop)
These are core programming structures.
πΉ WHY THIS LESSON IS IMPORTANT
Before students start coding:
They must understand:
Apps are not magic.
They are structured logic.
Algorithms are the foundation of:
-
Coding
-
Artificial Intelligence
-
Robotics
-
Software Engineering
πΉ STRATEGIC NOTEΒ
This lesson is optional but highly recommended because:
It prepares students for:
-
Debugging
-
Writing better logic
-
Using AI effectively
-
Participating competitively at NCC level