Discrete mathematics·Elementary·Method

Algorithm

An algorithm is a finite, clearly specified sequence of steps for solving a problem or carrying out a computation.

It is a repeatable set of instructions that reaches an answer.

What does algorithm mean?

A mathematical algorithm takes inputs, applies well-defined operations, and produces an output or reports that no solution was found. Correctness asks whether it returns the right result; efficiency studies resources such as time and memory as the input grows.

Algorithm examples

Example 1

Euclidean algorithm for 48 and 18.

Answer: 48=2·18+12; 18=1·12+6; 12=2·6, so gcd=6

Repeated division ends at the greatest common divisor.

Properties and types

  • Steps must be unambiguous.
  • A terminating algorithm finishes after finitely many steps.
  • Correctness and efficiency are separate questions.

Where is algorithm used?

This concept appears in a range of mathematical and practical settings:

  • Long division
  • Finding greatest common divisors
  • Sorting and numerical computation

Common misunderstandings

  • Calling an informal idea an algorithm without specifying its steps.
  • Confusing a correct method with an efficient one.