An algorithm is, alas, an informal concept, which can not have a precise mathematical definition. One can still attempt at an informal definition, and argue that it conveys the right (informal) intuition.
Because of its informal nature, sometimes it's also easy to argue against a given definition, attacking the definition wording. For instance, I've read more than once that an algorithm is a "sequence of steps" which makes my eyebrows raise, since it suggests that any algorithm will always halt within those number of steps, no matter how large the input is. Once, I had a conversation with a physicist where I couldn't follow their argument, and it turned out they identified "halting algorithm" with "constant-time algorithm" since they believed the number of steps were fixed by the algorithm (hence independent from the input).
If I had to define an algorithm, very informally, I would say that it is an informal but unambiguous description that, to each input, it associates a finite sequence of elementary computation steps which can be used to obtain the desired output.
This is far from being perfect. For instance, what is a "elementary computation step"? Further, it does not express that the mapping form input to the sequence of steps must be effective -- otherwise we could associate to all halting TM encodings the steps print 1
, and print 0
otherwise.
To fix these issues, I believe that we also need to convey the notion of computability in some way, which is however too much for that definition. One could refer to a specific formalism or programming language, but I'd want that definition to be computation-model-agnostic.
Indeed, one could say that an algorithm is an informal description of, say, a Java program, which is not as detailed as real code, yet is enough detailed that it could be turned into actual Java without needing to do further research, but only doing "coding". I would regard such a definition as quite inelegant, though.