# What is the difference between an algorithm and a heuristic?

Posted on

Algorithms and Heuristics are both methods of solving problems, but they differ in their methodology. Each can be used for a multitude of subjects, but algorithms are usually associated with mathematics, while heuristics are more loosely defined; the name can be applied to many processes that utilize experiential processing.

An Algorithm is a defined set of rules and/or steps used to solve specific problems. It is normally designed to run a problem through several states until a satisfactory conclusion is reached; for example, most math problems are solved using the Order of Operations -- multiply before dividing, parentheses first, etc. Using these rules, a user will be able to solve most problems that fit into that category without trouble, and all users will come up with the same result if they perform the calculations properly. Algorithms are also used in programming, as all computer technology is based in math; the operations of a processor chip are dictated by AND/OR decisions, which follow Algorithmic rules.

A Heuristic is any procedure that uses experience and/or trial-and-error testing to produce a result. While in day-to-day life, this can be as simple as testing different shoes until one pair fits, the specific word "Heuristic" is most often heard in computer programming. Procedural engines are built that do not rely on preset, finitely defined rules (as would an Algorithmic engine) but instead apply the user's actions against a learning template to produce better results on the fly. Virus protection programs often use Heuristic engines to seek out new viruses, spyware, and malware; programmers of these infectious programs change their systems constantly, so the virus protection program uses what it knows from previous scans as well as new definition lists and analysis to find infections that might otherwise slip past.

Both Algorithms and Heuristics serve a common goal, but Algorithms are more suited to mathematics, and Heuristics (even if not under that name) are used in everyday life for many reasons. While Algorithms will come up with solid answers (and usually the same answer each time), Heuristics will allow the user's experience to inform decisions that might take more time if worked through logically.

Sources: