Queues Flashcards

1
Q

What principle does a queue follow?

A

They follow a first in first out.

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

What are common uses for queues?

A

1 - Background tasks
2 - Uploading Resources
3 - Printing

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

What are ways to implement a queue?

A

You can implement a queue with an array and singly linked list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

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