🪜

Algorithmic Thinking Beginner

Learn what an algorithm is, how to write clear step-by-step instructions, and how to express simple logic using pseudocode and flowcharts.

8 lessons 19 tasks
Lessons Quiz Certificate

📚 Lessons

1 What Is an Algorithm?

An algorithm is a finite, ordered set of clear instructions that transforms one or more inputs into an output. The word comes from the name of the 9th-century Persian mathematician al-Khwārizmī. Algorithms appear everywhere: a recipe, a bus timetable, and a sorting app all follow algorithmic logic.

  • Algorithms must be finite — they must eventually stop.
  • Each step must be unambiguous — only one valid interpretation.
  • They must be general — able to handle a range of valid inputs.

A key property is determinism: given the same input, an algorithm always produces the same output. This distinguishes it from a guess or a random process.

2 Input, Process, Output

Every algorithm follows the IPO model: Input → Process → Output. Understanding what goes in, what transformation happens, and what comes out is the first step in designing any algorithm.

Example — making a cup of tea:
  INPUT:   teabag, cup, hot water, milk (optional)
  PROCESS: place teabag in cup
           pour hot water
           wait 3 minutes
           remove teabag
           add milk if desired
  OUTPUT:  a cup of tea

Identifying the IPO model before writing any steps prevents confusion about the algorithm's purpose. Ask yourself: What do I start with? What do I end with? What changes in between?

3 Clear and Unambiguous Steps

Each step in an algorithm must have exactly one interpretation. Vague instructions like "add some salt" or "wait a while" are not algorithmic — a computer (or another person following the steps strictly) would not know what to do.

  • Bad step: "Mix the ingredients well."
  • Good step: "Stir the mixture clockwise for 30 seconds."

Ambiguity leads to unpredictable results. When writing algorithms, replace every vague word with a precise, measurable action. This habit is the foundation of writing correct programs.

4 Sequencing and Order

Sequencing means steps are carried out one after another in a specific order. Changing the order of steps can produce a completely different — or incorrect — result.

Correct order — getting dressed:
  1. Put on underwear
  2. Put on trousers
  3. Put on shoes

Wrong order:
  1. Put on shoes
  2. Put on trousers   ← impossible!

Order matters in computing too. A program that reads a value before it is set will produce wrong answers. Always ask: Does step N depend on an earlier step completing first?

5 Pseudocode Basics

Pseudocode is an informal, language-agnostic way to write algorithm steps. It reads like English but uses structured keywords to show logic clearly. It is not meant to run on a computer — it is a planning and communication tool.

Common pseudocode keywords:
  SET x TO 5
  READ name
  PRINT "Hello, " + name
  IF age >= 18 THEN
      PRINT "Adult"
  ELSE
      PRINT "Minor"
  END IF

Pseudocode focuses on what must happen, not how a specific language syntax works. It bridges natural language and formal programs, making it easier to spot logical errors before writing real code.

6 Flowcharts

A flowchart is a visual representation of an algorithm. Different shapes represent different types of steps:

  • Oval — Start / End
  • Rectangle — Process (an action or calculation)
  • Diamond — Decision (a yes/no question)
  • Parallelogram — Input or Output

Arrows show the flow of control from one step to the next. Flowcharts are especially useful for visualising branches (decisions) and loops (repetition). They help communicate algorithm logic to people who may not read pseudocode.

Flowchart logic for checking a password:
  START
    → INPUT password
    → Is password correct? (Diamond)
        YES → PRINT "Welcome"  → END
        NO  → PRINT "Try again" → loop back to INPUT

7 Simple Loops and Conditionals

Conditionals let an algorithm make decisions: execute one set of steps if a condition is true, another if it is false. Loops let an algorithm repeat steps without writing them out multiple times.

Conditional (IF/ELSE):
  IF temperature > 30 THEN
      PRINT "It's hot"
  ELSE
      PRINT "It's cool"
  END IF

Loop (REPEAT … UNTIL):
  SET count TO 0
  REPEAT
      SET count TO count + 1
      PRINT count
  UNTIL count = 5

Loops are powerful but dangerous without a stopping condition. An infinite loop — one that never terminates — is a common algorithmic error. Always ensure the loop condition will eventually become false.

8 Deterministic vs Ambiguous Instructions

An instruction is deterministic if it produces exactly one result every time, regardless of who follows it. It is ambiguous if different people (or computers) could interpret it differently and get different results.

  • Deterministic: "Add 2 to the current value of x."
  • Ambiguous: "Make x a bit bigger."

Algorithms must be deterministic. A recipe that says "cook until done" is ambiguous — done for whom? At what temperature? Replacing subjective words with measurable criteria converts ambiguous instructions into true algorithmic steps. This discipline is what separates a precise algorithm from a vague description.

📝 Tasks

19 tasks across 7 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.