An algorithm is a step-by-step procedure that will always produce a
correct solution. A mathematical formula is a good example of a
problem-solving algorithm. While an algorithm guarantees an accurate
answer, it is not always the best approach to problem solving. This
strategy is not practical for many situations because it can be so
time-consuming. For example, if you were trying to figure out all of the
possible number combinations to a lock using an algorithm, it would
take a very long time!