In mathematics, an **algorithm** is a defined set of step-by-step procedures that provides the correct answer to a particular problem. By following the instructions correctly, you are guaranteed to arrive at the right answer. While often thought of purely as a mathematical term, the same type of process can be followed to ensure finding the correct answer when solving a problem or making a decision.

An algorithm is often expressed in the form of a graph, where a square represents each step.

Arrows then branch off from each step to point to possible directions that you may take to solve the problem. In some cases, you must follow a particular set of steps to solve the problem. In other instances, you might be able to follow different paths that will all lead to the same solution.

### Why Use an Algorithm?

The upside of using an algorithm to solve a problem or make a decision is that yields the best possible answer every time. This is useful in situations when accuracy is critical or where similar problems need to be frequently solved. In many cases, computer programs can be designed to speed up this process. Data then needs to be placed in the system so that the algorithm can be executed to come up with the correct solution.

The downside of using an algorithm to solve the problem is that this process tends to be very time-consuming. So if you face a situation where a decision needs to be made very quickly, you might be better off using a different problem-solving strategy.

### Algorithms vs. Heuristics

In psychology, algorithms are frequently contrasted with heuristics. A heuristic is a mental shortcut that allows people to quickly make judgments and solve problems. However, heuristics are really more of a rule-of-thumb; they don't always guarantee a correct solution.

So how do you determine when to use a heuristic and when to use an algorithm?

When problem-solving, deciding which method to use depends on the need for either accuracy or speed. If complete accuracy is required, it is best to use an algorithm. On the other hand, if time is an issue, then it may be best to use a heuristic.

Heuristics are more commonly used in everyday situations, such as figuring out the best route to get from point A to point B. While you could use an algorithm to map out every possible route and determine which one would be the fastest, that would be a very time-consuming process. Instead, your best option would be to use a route that you know has worked well in the past.

If you are working in a situation where you absolutely need the correct or best possible answer, your best bet is to use an algorithm. When you are solving problems for your math homework, you don't want to risk your grade on a guess. By following an algorithm, you can ensure that you will arrive at the correct answer to each problem.

**More Psychology Definitions:** The Psychology Dictionary