An algorithm is a step-by-step set of instructions that are followed to achieve some goal or outcome, often optimizing that outcome. They are formalized and can be expressed as a formula or "recipe". As such, they are reproducible in the sense that an algorithm will always provide the same output, given the same input. A heuristic amounts to an educated guess or gut feeling. Rather than following a set of rules or instructions, a heuristic is a mental shortcut. Moreover, it often produces sub-optimal and even irrational outcomes that may differ even when given the same input.