Big O Complexity Flashcards

(40 cards)

1
Q

vector access

A

O(1)

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

vector search

A

O(n)

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

vector insertion

A

end: O(1)
middle/front: O(n)

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

vector deletion

A

end: O(1)
middle/front: O(n)

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

stack access

A

top: O(1)

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

stack search

A

manual traversal: O(n)

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

stack insertion

A

push: O(1)

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

stack deletion

A

pop: O(1)

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

queue access

A

front/back: O(1)

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

queue search

A

manual traversal: O(n)

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

queue insertion

A

push: O(1)

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

queue deletion

A

pop: O(1)

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

priority_queue access

A

top: O(1)

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

priority_queue search

A

manual traversal: O(n)

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

priority_queue insertion

A

push: O(log n)

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

priority_queue deletion

A

pop: O(log n)

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

deque access

18
Q

deque search

19
Q

deque insertion

A

front/back: O(1)
middle: O(n)

20
Q

deque deletion

A

front/back: O(1)
middle: O(n)

21
Q

list access

22
Q

list deletion

A

given iterator: O(1)

22
Q

list search

23
Q

list insertion

A

given iterator: O(1)

24
unordered_map access
NA key-based
25
unordered_map search
avg: O(1) worst: O(n)
25
unordered_map insertion
avg: O(1)
26
unordered_map deletion
avg: O(1)
27
unordered_set access
NA key-based
28
unordered_set search
avg: O(1) worst: O(n)
29
unordered_set insertion
avg: O(1)
30
unordered_set deletion
avg: O(1)
31
map search
O(log n)
31
map access
NA key-based
32
map deletion
O(log n)
32
map insertion
O(log n)
32
set access
NA key-based
33
set search
O(log n)
34
set insertion
O(log n)
35
set deletion
O(log n)