Big O Notation Flashcards
1
Q
O(1)
A
Constant Time
Check first position / no matter the size, the run time will always be the same.
2
Q
O(log n)
A
Logarithmic Time / Binary Search
Each comparison halves the list.
3
Q
O(n)
A
Linear Time
For Loop / Run-time increases when items are added.
4
Q
O(n log n)
A
Quasilinear Time / Merge Sort
5
Q
O(n^2)
A
Quadratic Time / Bubble Sort
In each pass through the list n items will be examined with at most n passes.
Nested Loops
6
Q
O(2n)
A
Exponential Time
Growth doubles with each value added.
7
Q
O(n!)
A
Factorial Time
Grows in a factorial way based on the size of the input data.