What is an algorithm?
An algorithm is a complete, unambiguous recipe that always finishes in a finite number of steps.
A cake recipe saying “bake until golden” is not an algorithm: it is vague and open-ended. An algorithm must start from clear inputs, follow clear steps, and produce an output after finitely many operations.
Algorithm
A finite, unambiguous specification of a procedure to solve a problem, written in a well-defined formal language (code, pseudocode, flowchart, …).
Finding the smallest of three numbers
High-level idea: look at each number and remember the smallest so far. That idea becomes an algorithm only when you specify the exact comparisons and the return value — e.g. start with smallest = a, then update if b or c is smaller.
Key takeaways
- Finite steps + no ambiguity.
- Clear inputs and a guaranteed output.
- Informal instructions ≠ algorithms.