Big-O-Smallest-to-Largest Flashcards
1
Q
1: Constant
A
O(1)
2
Q
2: Logarithimic
A
O(log n)
3
Q
3: Linear
A
O(n)
4
Q
4: Linearithmic
A
O(n*log n)
5
Q
5: Quadratic
A
O(n^2)
6
Q
6: Cubic
A
O(n^3)
7
Q
8: Exponential
A
O(2^n) or O(e^n), where e > 1
8
Q
9: Factorial
A
O(n!)
9
Q
- Quartic
A
O(n^4)
10
Q
Array/List gets iterated over c * length times. Define Big O
A
O(n), where is n is the length of array or list
11
Q
How will you identify O(log n)
A
When number of elements in the problem space gets halved each time.
12
Q
How will you identify O(N^2)/Ouadratic
A
When we have a single nested loop
for (int i=0; i< n; i++{
for (int j=0; i
13
Q
Find Big O for this
for (int i=0; i
A
O(nm)
14
Q
Find Big O for this
for (int i=0; i
A
O(n^2)
15
Q
Find Big O for this
for (int i=0; i
A
O(n)
Outer loop i is doubled and incremented each time.