A technique designed for problem solving more quickly when classic methods are too slow for finding an exact or approximate solution.

How does it work?

When no algorithm can be made that delivers an answer fast enough, and if the domain allows it, a heuristic can provide a solution that is good enough.

A heuristic is a rule of thumb that is common in engineering. It provides a solution that is good enough in a specific case.


  • Traveling Salesman Problem (TSP) Heuristic - Nearest Neighbor
  • Anti-virus software tries to find viruses by pattern matching

When should you use it?

  • When a rigourous algorithm is too slow
  • When an inexact, yet good enough, solution is acceptable