Topic 8 - Analysis of Algorithms Flashcards

1
Q

If n is the number of items in a stack, what is the Big O of “push”?

A

O(1) if stack has room. If full, then O(n)

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

If n is the number of items in a LinkedStack, what is the Big O of “push”?

A

O(1)

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

Pop?

A

O(1)

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

Peek?

A

O(1)

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