Big O Notation
Types of Problems
Heuristic
100

If an algorithm’s runtime grows in direct proportion to the input size, it is described with this Big-O notation.

O(n) (linear)

100

A problem that asks only for a “yes” or “no” answer.

Decision Problems

100

Should you use a heuristic if you can solve the problem exactly in a reasonable time?

No
200

If an algorithm’s runtime doubles each time the input increases by 1, it is described with this Big-O notation.

O(2^n) (exponential)
200

A problem that asks for the “best” solution out of many possible solutions

Optimization Problems

200

Should you use a heuristic if the problem is too big or takes too long to solve exactly?

Yes

300

An algorithm that always takes the same amount of time, no matter the input size, is described with this Big-O notation

O(1) (constant)

300

“What is the shortest path between two cities?” is an example of this type of problem

Optimization Problems

300

Should you use a heuristic if you only need a “good enough” answer, not the perfect one?

Yes

M
e
n
u