Queues Flashcards
1
Q
What principle does a queue follow?
A
They follow a first in first out.
2
Q
What are common uses for queues?
A
1 - Background tasks
2 - Uploading Resources
3 - Printing
3
Q
What are ways to implement a queue?
A
You can implement a queue with an array and singly linked list.
4
Q
How can we implement a queue with an array? What are the downsides?
A
You can use unshift to add a value and pop to remove the first value.
There is no way around indexing.
5
Q
How would we create a queue with a singly linked list?
Implement it.
A
You want to add from the tail and remove from the head.