Foundations · StudentHub Lesson

Algorithms & Pseudocode

Learn what algorithms are and how to describe them using pseudocode before writing real code.

17 minBeginner
01

What you will learn

  • Define what an algorithm is
  • Write simple algorithms in plain pseudocode
  • Compare different algorithms for the same problem
  • Understand efficiency at a basic level
  • Practice tracing through an algorithm step by step
02

Watch the lesson

Intro to Algorithms: Crash Course Computer Science #13 · CrashCourse

Watch on YouTube
03

Topic notes

Main Idea

An algorithm is a precise sequence of steps used to solve a problem or complete a computation.

Key Concepts

  • Algorithms exist independently of any programming language
  • Pseudocode describes algorithm steps in plain, structured language
  • Multiple algorithms can solve the same problem with different efficiency
  • Tracing an algorithm means following its steps manually

Definitions

  • Algorithm: a finite sequence of steps to solve a problem
  • Pseudocode: informal, human-readable description of an algorithm
  • Efficiency: how much time or resources an algorithm needs

Syntax Example

```

START

SET total = 0

FOR each number in list

ADD number to total

PRINT total

END

```

Examples

  • A recipe is an everyday algorithm
  • Sorting a list of names alphabetically can be done with different algorithms

Common Mistakes

  • Confusing pseudocode with actual programming syntax
  • Skipping steps assuming they're 'obvious'
04

Key concepts

Definition of algorithmPseudocode structureAlgorithm efficiencyTracing steps
05

Important terms

Algorithm
A precise sequence of steps to solve a problem
Pseudocode
Plain-language representation of an algorithm's logic
06

Worked examples

Problem

Write pseudocode to find the largest number in a list

  1. 1. SET max = first number
  2. 2. FOR each number in list
  3. 3. IF number > max THEN max = number
  4. 4. PRINT max

Answer: The pseudocode correctly finds the maximum value

07

Quick revision

  • Algorithms are step-by-step solutions
  • Pseudocode is not real code
  • Different algorithms can solve the same problem
  • Efficiency measures speed/resources used
  • Tracing helps verify correctness
08

Check your understanding

Question 1 · Multiple choice

What is an algorithm?

Question 2 · Multiple choice

What is pseudocode used for?

Question 3 · True or false

There is only ever one correct algorithm for a given problem.

Question 4 · Short answer

Give a real-world example of an algorithm.

Question 5 · Short answer

Why do we trace through an algorithm's steps?

Done with Algorithms & Pseudocode?

Sign in to save your progress across the library.