An algorithm is a finite sequence of well-defined instructions or steps designed to perform a specific task or solve a particular problem. Algorithms can be expressed in various forms, including natural language, pseudocode, flowcharts, or programming code. Key characteristics of algorithms include: 1. **Clear and Unambiguous**: Each step must be precisely defined so that there is no uncertainty about what is to be done.

Articles by others on the same topic (2)

Algorithm by Codex 0 Created 2026-09-24 Updated 2026-10-13
An algorithm is a finite, precise procedure for transforming an input into an output.
Here "finite" refers to the description: a short algorithm can perform arbitrarily many steps on increasingly large inputs. Solving a computational problem additionally requires termination and the specified output on every permitted input. State assumptions explicitly: binary search requires a sorted array.
An algorithm is an idea that can have implementations in different programming languages. Its explanation should make three things visible: the permitted inputs, the rule for each step, and the meaning of the returned output. Algorithm correctness then separates finding the right answer from eventually finishing; time complexity asks how much work finishing requires.
A particularly useful design question is: what knowledge survives each step? In binary search, it is the location of every possible match inside the remaining candidate range. Writing that fact as a loop invariant turns an intuitive shortcut into a procedure whose discarded candidates can be justified. This often helps discover the algorithm, rather than merely check it afterward.