Digital Tech Notes (JSS1 - SS3)

Basic Algorithms and Flowchart

Learn what algorithms are, how to solve problems step by step, and how to use flowcharts and pseudocode. Perfect for JSS 2 Computer Studies students i

 



Introduction:

Think about the last time you made a pot of jollof rice. You did not just throw everything into the pot at random. You followed steps — wash the rice, blend the tomatoes, heat the oil, add the ingredients one after another, and then allow it to cook. Without following those steps in the right order, the result would be a disaster.


That is exactly what an algorithm is. And it is one of the most important ideas in computer science.

Every app on your phone, every website you visit, every ATM transaction you make — all of them work because someone sat down and wrote out clear, logical steps for the computer to follow. In JSS 2 Computer Studies, understanding algorithms is the foundation for everything that comes after. When you understand how to think logically and break a problem into steps, you are already thinking like a programmer.

This lesson will walk you through what algorithms mean, how to solve problems step by step, and how to represent those steps using flowcharts and pseudocode. By the end, you will see that algorithmic thinking is not just for computer experts — it is something you already do every day without even realising it.


Learning Objectives

By the end of this lesson, students should be able to:

  1. Define the term algorithm in their own words
  2. Identify and explain the steps involved in problem solving
  3. Draw simple flowcharts using the correct symbols
  4. Write basic pseudocode to describe a solution to a problem
  5. Distinguish between flowcharts and pseudocode and explain when each is useful
  6. Apply algorithmic thinking to everyday real-life situations in Nigeria

What Is an Algorithm?

An algorithm is a set of clear, step-by-step instructions used to solve a problem or complete a task. The steps must be arranged in a specific order, and each step must be precise so that anyone — or any computer — following them will arrive at the correct answer.

The word "algorithm" comes from the name of a 9th-century Persian mathematician called Muhammad ibn Musa al-Khwarizmi. He wrote books on mathematics that were later translated into Latin, and his name eventually gave us the word we use today.

Here is a simple way to think about it: an algorithm is like a recipe. A recipe tells you what ingredients to use, in what quantities, and in what order to combine them. If you follow the recipe correctly, you get the expected meal. If you skip a step or change the order, something goes wrong.

For a computer, algorithms are even more important. A computer does not think for itself. It can only do exactly what it is told, in the exact order it is told. This means the algorithm must be perfect — no missing steps, no vague instructions.

Characteristics of a Good Algorithm

For an algorithm to be useful, especially in computing, it must have certain qualities:

It must have a definite start and a definite end. An algorithm that keeps running forever without finishing is useless.

Every step must be clear and unambiguous. The computer must know exactly what to do at each stage.

It must be effective, meaning every instruction must be simple enough to be carried out.

It should produce the correct result for the given input.

It should be efficient, meaning it should solve the problem without wasting unnecessary time or steps.


Steps in Problem Solving

Before you can write an algorithm, you need to know how to approach a problem. Problem solving in computing follows a structured process. Let us go through each step using a Nigerian example.

Step 1 — Understanding the Problem

The first thing you must do is fully understand what the problem is asking. Read the problem carefully. Ask yourself: What information has been given? What result am I expected to produce?

Example: A school in Lagos wants a program that collects a student's score in a test and tells them whether they passed or failed. Before writing any algorithm, you need to understand that you are working with a number (the score) and you need to compare it to a pass mark — say, 50 out of 100.

Step 2 — Analysing the Problem

Once you understand the problem, analyse it. Break it down into smaller parts. Identify the inputs (what information goes in), the process (what happens to that information), and the output (what result comes out).

Using our example: Input — the student's score Process — compare the score to the pass mark of 50 Output — "Pass" or "Fail"

Step 3 — Designing the Solution

Now you plan how to solve it. This is where you write out your algorithm — the logical steps. You are not writing a computer program yet. You are just planning what needs to happen and in what order.

Step 4 — Writing the Algorithm or Code

After designing, you write the actual instructions. This could be in pseudocode, a flowchart, or eventually a programming language like Python or Scratch.

Step 5 — Testing and Debugging

After writing the algorithm, you test it with different inputs to see if it gives the correct output. If something is wrong, you fix it. In computing, fixing errors in an algorithm or code is called debugging.

Step 6 — Evaluating the Solution

Finally, you review your solution. Is it giving correct results? Is it fast enough? Can it be simplified? This step ensures your solution is not just correct but also efficient.

Example 1. Write the algorithm to find the sum and product of two given numbers. 

 Algorithm: To find the sum and product of two given numbers: 

Step 1: Read A , B 

Step 2: Let Sum= A+B 

Step 3: Let Product=A*B 

Step 4: Print Sum, Product 

Step 5: Stop.


Example 2: Develop an algorithm to interchange the values assigned to two variables A and B. (For example, if A=2 and B=3, after interchange, it should be A=3 and B=2). 

Algorithm: To interchange the values. 

Step 1: [Initialize the variables] A = 2 B = 3 

Step 2: [Peform the operations] TEMP = A A = B B = TEMP 

Step 3: [Print the result] Print A, B 

Step 4: [Finished] Stop



Example 3: What is meant by algorithm? Write an algorithm to find and

print the smaller number from two given numbers.

Solution: An algorithm is a logical list of procedures or steps for solving

a given problem.

Algorithm: To find the smallest number from two given numbers:

Step 1: [Enter numbers]

               Read A, B

Step 2: [Perform the operations]

               If (A<B) then

             Print smallest number is A

              Else

              Print smallest number is B

              End If

Step 3:  [Finished]

              Stop


What Is a Flowchart?

A flowchart is a diagram that shows the steps of an algorithm using shapes and arrows. Each shape represents a different type of action, and the arrows show the direction of flow — meaning they show you which step comes next.

Flowcharts are very useful because they let you see the whole algorithm at a glance. Instead of reading through lines of text, you follow the shapes and arrows from the start to the end. This makes it easier to spot mistakes or missing steps.

Flowchart Symbols and Their Meanings



You need to learn the standard symbols used in flowcharts. Here they are:

Oval or Rounded Rectangle — This is the Terminal symbol. It marks the Start and End of the flowchart. Every flowchart must have a START oval and a STOP or END oval.

Rectangle — This is the Process symbol. It shows an action or calculation being performed. For example, "Calculate total score" or "Add two numbers."

Parallelogram (Slanted Rectangle) — This is the Input/Output symbol. It shows information being entered into the system or a result being displayed. For example, "Enter student score" or "Display result."

Diamond — This is the Decision symbol. It shows a question or condition that has two possible answers — usually YES or NO. For example, "Is the score greater than or equal to 50?" leads to either a YES path or a NO path.

Arrows — These show the direction of flow, connecting one symbol to the next.

Drawing a Simple Flowchart — Nigerian Example

Let us draw a flowchart for the student score problem.

Start Enter student score Is the score greater than or equal to 50? — YES → Display "You have passed" — NO → Display "You have failed" Stop

If you draw this using the correct shapes — oval at the start, parallelogram for entering the score, diamond for the question, rectangles or parallelograms for the output messages, and an oval at the end — you will have a complete flowchart.

Another Example — Checking if a Number Is Even or Odd

Start Enter a number Divide the number by 2 and check the remainder Is the remainder equal to 0? — YES → Display "The number is Even" — NO → Display "The number is Odd" Stop



These are the kinds of problems you will commonly encounter in JSS 2 Computer Studies.

Tips for Drawing Flowcharts

Always start with a clear understanding of the problem before drawing. Only one arrow should enter each shape (except after a decision diamond, which has two outgoing arrows — one for YES and one for NO). Make sure every path through the flowchart leads to a STOP. Label your YES and NO branches clearly.


What Is Pseudocode?

Pseudocode is a way of writing an algorithm using plain English words that look similar to a programming language but are not actual code. The word "pseudo" means fake or imitation. So pseudocode is basically a fake or simplified version of code that anyone can read and understand, even if they do not know how to program.

Unlike a flowchart which is visual, pseudocode is text-based. It uses keywords like START, END, INPUT, OUTPUT, IF, ELSE, and WHILE to describe the steps of a solution in a structured way.

Why Use Pseudocode?

Pseudocode is faster to write than a flowchart. When you have a complex algorithm with many steps, writing it in pseudocode takes less time than drawing all the shapes and arrows.

It is also easier to turn pseudocode directly into an actual programming language. Once you write pseudocode, converting it to Python, JavaScript, or any other language becomes straightforward.


Writing Pseudocode — Example 1 (Student Score)

START 

INPUT student_score 

IF student_score >= 50 

THEN OUTPUT "You have passed" 

ELSE OUTPUT "You have failed" 

END IF 

END


Writing Pseudocode — Example 2 (Even or Odd Number)

START 

INPUT number 

IF number MOD 2 = 0 

THEN OUTPUT "The number is Even" 

ELSE 

OUTPUT "The number is Odd" 

END IF 

END

Note: MOD means the remainder when you divide one number by another. For example, 10 MOD 2 = 0, so 10 is even. 7 MOD 2 = 1, so 7 is odd.



Writing Pseudocode — Example 3 (Calculating Average Score for Three Subjects)

START 

INPUT score1, score2, score3 

total = score1 + score2 + score3 

average = total / 3 

OUTPUT average 

END


These three examples cover the basic kinds of algorithms you will be expected to write in JSS 2.


Differences Between Flowcharts and Pseudocode

Many students ask: which one is better — a flowchart or pseudocode? The truth is that both are useful, and which one you use often depends on the situation.

A flowchart is a diagram while pseudocode is written text. Flowcharts are better for showing the overall logic visually, making it easier for beginners to follow. Pseudocode is better for complex algorithms that involve many steps because writing text is faster than drawing many shapes.

Flowcharts can take a long time to draw, especially for long algorithms. Pseudocode can be written quickly and easily edited.

Both are planning tools. Neither of them is the final computer program — they are used to plan and communicate your solution before writing actual code.


Practical Applications of Algorithms in Nigeria

Algorithms are not just classroom ideas. They are used in real life all around us in Nigeria every single day.

When you use an ATM to withdraw money, an algorithm checks your PIN, verifies your account balance, and processes the transaction.

When MTN or Airtel sends you a low-balance notification, an algorithm ran in the background, checked your airtime balance, compared it to a set value, and triggered the notification.

When WAEC or JAMB uses a computer to mark objective questions, an algorithm compares your answers to the correct ones and calculates your score.

On food delivery apps like Chowdeck or Jumia Food, algorithms figure out the best route from a restaurant to your house.

Even Google Search uses algorithms to decide which website should appear first when you type a question.

The Nigerian banking apps like Kuda, Opay, and Palmpay use complex algorithms to process millions of transactions every day securely.

These examples show that learning algorithms now is preparing you for a future where technology will be everywhere in Nigeria.


Advantages and Disadvantages of Using Algorithms

Advantages

Algorithms make problem solving organised and logical. You do not rely on guessing — you follow a clear plan.

They can be reused. Once you write a good algorithm, you or someone else can use it again for similar problems.

Algorithms help identify errors early. By planning your solution step by step, you spot problems before you start writing actual code.

They make communication easier. When developers work in teams, algorithms help them explain their solutions to each other clearly.

Disadvantages

Writing a good algorithm takes time and effort, especially for complex problems.

If the algorithm contains an error, every program built from it will also produce wrong results.

Flowcharts can become very large and difficult to manage for complex systems.

Pseudocode is not standardised — different people may write it in slightly different ways, which can cause confusion.


Ethical Considerations

As you begin to learn how algorithms work, it is also important to think about how they should be used responsibly.

Fairness in Algorithms

Algorithms should be designed to treat everyone equally. In Nigeria, if a company uses an algorithm to decide who gets a bank loan or who gets hired for a job, that algorithm must not be biased against people based on their tribe, gender, or location.

Data Privacy

Many algorithms work with personal data — names, phone numbers, addresses, and financial information. You must never use other people's data without their permission. Organisations that collect data in Nigeria are expected to protect it under data privacy principles.

Transparency

People should know when an algorithm is making decisions that affect them. For example, if a school uses an algorithm to assign students to classrooms, students and parents should be able to understand how it works.

Always Remember: Powerful tools can be used for good or for harm. Learning to code and build algorithms comes with a responsibility to use that knowledge ethically.


Classroom and Home Activities

Activity 1 — Everyday Algorithm

Write a step-by-step algorithm for brushing your teeth in the morning. Make sure your algorithm has a clear start and end, and that the steps are in the correct order. Then, exchange with a classmate and see if they can follow your steps perfectly.

Activity 2 — Draw a Flowchart

Draw a flowchart for the following problem: A shopkeeper in Onitsha market sells a bag of rice for N25,000. A customer enters the amount of money they have. The flowchart should check if the customer has enough money, and display either "You can buy the rice" or "You do not have enough money."

Activity 3 — Write Pseudocode

Write pseudocode to find the largest of two numbers entered by a user. Use an IF-ELSE structure.

Activity 4 — Group Discussion

In groups of four, think of three everyday activities in your school or home that follow a step-by-step process. Discuss how these activities are similar to algorithms and present your findings to the class.


Assessment Questions

Objective Questions

  1. An algorithm is best described as: a) A type of computer hardware b) A set of step-by-step instructions for solving a problem c) A programming language used in Nigeria d) A tool for drawing diagrams

  2. Which flowchart symbol is used to represent a decision? a) Rectangle b) Oval c) Diamond d) Parallelogram

  3. What does the oval shape represent in a flowchart? a) A calculation process b) Input or output c) Start or end of the algorithm d) A condition or question

  4. Pseudocode is best described as: a) Actual computer code written in Python b) A visual diagram showing algorithm steps c) A simplified, English-like way of writing an algorithm d) A type of flowchart symbol

  5. In pseudocode, what does "MOD" mean? a) The result of multiplication b) The remainder after division c) The total after addition d) The quotient after division

Theory Questions

  1. Explain what an algorithm is and state three characteristics of a good algorithm. Use a Nigerian everyday example to support your answer.

  2. Draw a flowchart to determine whether a number entered by a user is positive, negative, or zero.

  3. Write a pseudocode for a simple program that asks a user to enter two numbers and then displays their sum, difference, and product.


Summary

In this lesson, you have learned that an algorithm is a set of clear, step-by-step instructions used to solve a problem. Before writing an algorithm, a programmer follows a structured problem-solving process that includes understanding the problem, analysing it, designing a solution, writing it out, testing it, and evaluating the result.

A flowchart is a visual tool that uses shapes and arrows to represent an algorithm. Each shape has a specific meaning — the oval marks the start and end, the rectangle shows a process, the parallelogram shows input or output, and the diamond represents a decision.

Pseudocode, on the other hand, is a text-based way of writing an algorithm using simple English keywords. It is faster to write than a flowchart and easier to convert into actual code.

Both tools are used to plan and communicate solutions before actual programming begins. Algorithms are not just academic — they power everyday technology around us in Nigeria, from ATMs to mobile banking apps to online exam marking systems.


Conclusion

Learning about algorithms might feel like a small step, but it is actually the foundation of everything in computer science. The ability to break a problem into clear, logical steps is a skill that will serve you well — not just in programming, but in every area of life.

Nigerian students who master algorithmic thinking today are building the mindset needed to create apps, solve national problems with technology, and compete in the global digital economy. Whether you go on to become a software developer, a data analyst, a doctor using health technology, or an entrepreneur building the next Paystack or Interswitch, the logical thinking you develop here will always matter.

Start small — pick everyday activities, write out the steps, draw simple flowcharts, and practise writing pseudocode. The more you do it, the more natural it becomes. One step at a time.


Frequently Asked Questions (FAQ)

What is an algorithm in simple terms for JSS 2 students?

An algorithm is simply a list of steps you follow to solve a problem or complete a task. Think of it like a recipe — you follow each step in order to get the right result. In computing, algorithms tell the computer exactly what to do.

What is the difference between a flowchart and pseudocode?

A flowchart is a visual diagram that uses shapes and arrows to show the steps of an algorithm. Pseudocode is a text-based method that uses simple English keywords to describe the same steps. Flowcharts are better for visual learners and simple problems, while pseudocode is faster and more practical for complex algorithms.

Why do we use flowcharts in Computer Studies?

Flowcharts help us plan and visualise a solution before writing actual code. They make it easy to see the logical flow of a program, spot errors early, and communicate ideas to others. They are an important tool in programming and system design.

Is pseudocode the same as programming code?

No. Pseudocode is not written in any specific programming language and cannot be run on a computer. It is a planning tool — a way to describe your solution in plain English before translating it into a real programming language like Python, Java, or Scratch.

How is an algorithm used in everyday life in Nigeria?

Algorithms are used all around us. When you use an ATM, when Airtel sends you a low-balance alert, when JAMB marks your UTME answers, when Google shows you search results — all of these involve algorithms working behind the scenes to process information and produce results.

What are the steps in problem solving in Computer Studies?

The steps are: understand the problem, analyse the problem (identify inputs, processes, and outputs), design the solution, write the algorithm or code, test and debug it, and finally evaluate the result to make sure it is correct and efficient.

I am Echofu George Adah, the Pioneer of Digital Tech Note and the Founder and Chief Executive Officer of GeoWeb Technologies Limited, an information technology company committed to providing cutting-edge ICT solutions.