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)
2
Q
If n is the number of items in a LinkedStack, what is the Big O of “push”?
A
O(1)
3
Q
Pop?
A
O(1)
4
Q
Peek?
A
O(1)