Complexity Flashcards

1
Q

give the linear search complexities

A
worst O(n)
best O(1)
average O(n)
space O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

give the binary search complexities

A
worst O(log n)
best O(1)
average O(log n)
space O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

define big O

A

f(n) is O(g(n))
if there exists n_0 >= 1, c > 0 such that
f(n) <= cg(n)
for every n >= n_0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

give the complexities from worst to best

A
n^n
n^2
n log n
n
log n
1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly