Stack/Queue Flashcards

1
Q

Time Complexity for Stack and Queue:

A
Depending on implementation:
if a resizeable array:
Queue
Retrieval O(N)
Search O(N)
Insertion O(1)
Deletion O(1)
Stack
Retrieval O(N)
SearchO(n)
InsertionO(1)
deletion O(1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is FIFO

A

First in first out. Queues use this principle to be implemented in. The first value entered in the queue will be retrieved while the most recent entry is at the end.

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

What is LIFO

A

Last in First Out. Stacks implement this. The first value entered will be the last value removed if other entries are entered. Example, a stack of papers.

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