stacks and queues Flashcards
1
Q
What is a stack?
A
A LIFO (‘last in first out’) data structure, where items can only be removed from and added to the top of the list.
2
Q
Give an example of where stacks may be used.
A
- Back button in a web page
- Undo buttons
3
Q
What is a queue?
A
A FIFO (‘first in first out’) data structure, where items are added to the end of the queue and removed from the front of the queue.