Back to Topic 6.2 — Data structures
6.2.4Computer Science SL5 flashcards

Queues (FIFO)

Practice Flashcards

Flip to reveal answers
Card 1 of 56.2.4
6.2.4
Question

What is a queue?

Click to reveal answer

Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.

All 5 Flashcards — Queues (FIFO)

Sign up free to track progress and get spaced-repetition review schedules.

Card 1definition

Question

What is a queue?

Answer

A structure added to at one end and taken from at the other: items join at the back and leave from the front. The first item in is the first out — first in, first out, or FIFO.

Card 2definition

Question

What are the four queue operations?

Answer

enqueue adds an item at the back; dequeue removes the item at the front and returns it; front returns the next item out without removing it; isEmpty says whether anyone is waiting.

Card 3concept

Question

Why is a plain list a poor implementation of a queue?

Answer

Removing from the front of a list shifts every remaining item down one place, which is O(n) every time. A proper queue structure removes from the front in constant time.

Card 4concept

Question

What one question chooses between a stack and a queue?

Answer

Does the most recent item matter most, or the one that has waited longest? Most recent means a stack; longest waiting means a queue.

Card 5example

Question

Give three uses of a queue.

Answer

Print jobs, so they print in the order sent; process scheduling, where round robin takes the front process and returns it to the back; and buffering data such as keystrokes or network packets, which must be handled in arrival order.

Track your progress with spaced repetition

Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.

Start Free