Stacks & Queues Flashcards

1
Q

What is a stack? What are its key operations?

A

LIFO (Last In, First Out), operations: push(), pop(), peek().

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

What is a queue? How does it differ from a stack?

A

FIFO (First In, First Out), operations: enqueue(), dequeue().

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

How does a priority queue work?

A

Elements are dequeued in order of priority rather than order of insertion.

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

In a min priority q where are the smallest elements?

A

the root

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