An algorithm is a finite, well-defined sequence of steps that transforms input into the desired output. We judge it on two axes: correctness (does it always produce the right answer?) and efficiency (how much time and memory does it use?).
The idea
A valid algorithm must be unambiguous (each step is clear), finite (it terminates), and produce the correct result for every valid input.
