The 5 Essential Properties (Knuth's Criteria)
- Input — zero or more well-defined inputs
- Output — at least one well-defined output, related to the input
- Definiteness — each step must be precisely and unambiguously defined
- Finiteness — must terminate after a finite number of steps (distinguishes an algorithm from a general "computational procedure")
- Effectiveness — every step must be basic enough to be carried out, in principle, by a person using pencil and paper (i.e., feasible/executable)
Concrete Examples for Each Property
- Input: a sorting algorithm takes an array as input — but "zero inputs" is also valid (a program that just prints "Hello World" has zero inputs and is still a valid algorithm).
- Output: a search algorithm outputs the found index or -1 — output MUST relate to the given input, not just print something unrelated.
- Definiteness: "add a large amount of salt" is NOT definite ("large" is ambiguous); "add exactly 5 grams of salt" IS definite.
- Finiteness: "keep dividing n by 2 (integer division) until n=0" terminates — finite. "Keep printing the next prime number forever" never terminates — this is an infinite process, not a valid algorithm.
- Effectiveness: "sort the array using intuition" is not effective (not concretely executable); "compare arr[i] and arr[i+1], swap if out of order" is effective — basic enough to actually carry out step by step.
Self-Test: Spot the Violated Property
- "Compute the sum of the series 1+2+3+... continuing forever." — which property is violated? (Answer: Finiteness — never terminates by design.)
- An algorithm step says: "Multiply the numbers using an intuitive approach." — which property is violated? (Answer: Definiteness — "intuitive" is ambiguous, not a precise instruction.)
- An algorithm step says: "Solve the equation using imagination." — which property is violated? (Answer: Effectiveness — not a basic, concretely executable step.)
Common Confusion
- A process or program that runs indefinitely (e.g., an OS scheduler loop) is not a pure algorithm by strict definition, since it lacks finiteness — frequently tested distinction
Exam Angle / MCQ Trap
Examiners love asking "which property distinguishes an algorithm from a mere sequence of steps?" — answer: Finiteness (must halt) combined with Definiteness (unambiguous). Memorize all 5 by name, not just concept.