summaryrefslogtreecommitdiff
path: root/complexity.md
blob: 9327bb44a3eaf28e386057c32bf9f940557cc9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Time Complexity

## Big O

Big O is a way to categorize an algorithm's time or memory requirements based on
input. It is not meant to be an exact measurement. It will not tell you how many
CPU cycles it takes, instead it is meant to generalize the growth of the
algorithm as the input grows.

- Look for loops
- Constants are dropped (Big O describes the upper bound or growth of the
  algorithm where the constant eventually becomes irrelevant)
- We often only consider worst case (e.g., searching through a list where the
  element you want is the last one)