Computer Science Grade 7 20 min

What is an Algorithm?

What is an Algorithm?

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Define the term 'algorithm' in their own words. Identify the key characteristics of a good algorithm (clear, finite, correct). Recognize algorithms in everyday tasks like making a sandwich or following a recipe. Translate a simple real-world task into a step-by-step written algorithm. Explain why the order of steps in an algorithm is critical for success. Differentiate between an algorithm (the plan) and a computer program (the implementation of the plan). Ever wonder how your phone knows the fastest way to get to the pizza place? 🍕 It's not magic, it's an algorithm! In this chapter, you'll discover that an algorithm is just a fancy word for a step-by-step plan. We'll learn how to spot algorithms all around us, from the kit...
2

Key Concepts & Vocabulary

TermDefinitionExample AlgorithmA step-by-step set of instructions or rules for solving a problem or completing a task.A recipe for baking cookies is an algorithm. It lists the ingredients (inputs) and the exact steps to get a finished cookie (output). Instruction / StepA single, clear action to be performed within an algorithm.In a cookie recipe, a single instruction is: 'Add 2 cups of flour to the bowl.' SequenceThe specific order in which instructions are performed. The order is crucial for the correct outcome.You must mix the cookie dough ingredients *before* you put the cookies in the oven. Doing it in the wrong sequence won't work. InputThe information or materials an algorithm needs to start working.For a recipe algorithm, the inputs are the ingredients like flour, su...
3

Core Syntax & Patterns

Rule 1: Algorithms Must Be Unambiguous (Clear) Each step must have only one possible meaning. A computer can't guess what you mean. An instruction like 'Add some sugar' is ambiguous because 'some' could mean anything. A clear instruction is 'Add 1 cup of sugar'. Rule 2: Algorithms Must Be Finite (Have an End) An algorithm must eventually stop after a specific number of steps. An algorithm can't run forever. An algorithm to count from 1 to 100 has a clear end. An instruction like 'Keep stirring forever' would create a useless, non-finishing algorithm. Rule 3: Order Matters (Sequence is Critical) The steps must be in the correct logical order to get the right result. You can't frost a cake before you bake it. In th...

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
You are writing an algorithm for a robot to 'clean a room'. Which instruction best demonstrates the principle of breaking down a task and not assuming knowledge?
A.Pick up all the trash.
B.Make the room look tidy.
C.Clean until the room is clean.
D.1. Scan the floor for any object smaller than a book. 2. If an object is found, pick it up. 3. Place the object in the trash bin.
Challenging
An algorithm to sort the list [10, 2, 5] from smallest to largest begins with these steps: 1. Compare the first two numbers (10 and 2). 2. Because 2 is smaller than 10, swap their positions. The list is now [2, 10, 5]. What fundamental concept of algorithms does this process demonstrate?
A.The importance of sequence and intermediate steps to reach a final correct state.
B.That all algorithms must have at least three numbers as input.
C.That algorithms must always start with the largest number.
D.The difference between an algorithm and a program.
Challenging
A student writes an algorithm to find the smallest number in [12, 4, 25, 8]. Their first step is 'Set smallest_so_far to 100'. Assuming the rest of the algorithm is correct (comparing each number to smallest_so_far and updating if a smaller one is found), why will this algorithm still produce the correct answer (4)?
A.It won't work; you must start with a number from the list.
B.It works because 100 is larger than any number in the list, so the first comparison (100 vs 12) will immediately correct 'smallest_so_far' to 12.
C.It only works because the list has an even number of items.
D.It works because 100 is a special number in computer science.

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

More from Chapter 1: The Magic of Algorithms: From Everyday Life to Computer Code

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.