Skip to main content
Mathematical computing
Lesson 66 of 75
Introduction

Algorithms and pseudocode

Objective. Specify terminating mathematical algorithms.

  1. 1. Learn
  2. 2. Worked example
  3. 3. Practice
  4. 4. Feedback
  5. 5. Continue

Learn: the key idea

Algorithms and pseudocode describe a precise, finite sequence of steps that solves a mathematical problem, written in structured informal notation using loops, conditionals and variable assignment. A well-specified algorithm must terminate, meaning some quantity (a loop counter or a shrinking interval) must provably reach a stopping condition after finitely many steps. For example, pseudocode to find the maximum of a list sets max ← list[0], then loops through remaining entries, updating max whenever a larger value is found, terminating once every entry has been checked. Clear pseudocode states inputs, outputs, and the exact update rule at each step.

Worked example

Write pseudocode-based reasoning, as part of studying algorithms, to find the sum of the first n positive integers, then give the result for n = 10.

Write pseudocode-based re…
Illustrated card showing Write pseudocode-based reasoning
  1. 1Pseudocode: set sum ← 0, loop i from 1 to n, sum ← sum + i
  2. 2This computes sum = 1 + 2 + ... + n
  3. 3Use the closed form n(n+1)/2 to check termination value
  4. 4Substitute n=10: sum = 10(11)/2 = 55

Answer: 55

Concept mastery

Based on your past attempts at this lesson — the question types to practise again come first.

Complete a practice set to see your concept breakdown here.

Practice

Practice happens on its own screen, one question at a time. Answers stay hidden until you submit yours, and you can stop and pick up at the same question later.

Start practising

Common mistake. Writing a loop condition that can never become false, such as 'while x > 0: x ← x + 1'; the algorithm never terminates because x only grows, so always verify the loop variable moves towards the stopping condition.

Your progress

Tick each step as you finish it. Your exact reading position is saved automatically, so Continue drops you back on the same line.

0 of 5 steps complete

Your place saves automatically as you read.

My dashboard