data-structures-queues Flashcards

1
Q

What does the acronym FIFO mean?

A

First-in-first-out: The first thing “enqueue”d onto the queue is the first thing that be “dequeue”d out.

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

What methods are available on a Queue data structure?

A
  1. enqueue(value) - adds a value to the back of the queue
  2. dequeue() - removes the “front” value from the queue and returns it
  3. peek() - returns the “front” value of the queue without removing it
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What must you do to access the value at an arbitrary point in a queue (not just the “front”)?

A

Keep “dequeue”ing the queue and store each “dequeue”d value in a variable until you reach the arbitrary point. Then you can “enqueue” the “dequeue”d values back onto the queue.

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