Queues Flashcards
What are queues?
Abstract data types that hold ordered linear sequences of items
What kind of structure do they have?
FIFO (first in, first out)
How do queues keep order?
A pointer at the front of the queue which indicates element one and an end pointer.
What happens to queue when an element is removed?
Nothing, he remaining elements do not move up to the front of the queue
Define a priority queue?
A queue where each element has a priority so new elements can be added in front of lower priority ones.
What does enqueue(data) do?
Adds an element to a queue
What does dequeue() do?
Returns an element from the front of the queue
What does is_empty() do?
Check whether the queue is empty
What does is_full() do?
Check whether the queue is at maximum capacity
What kind of implementation can occur?
Static or dynamic
What are the main operations of a queue?
Adding and removing items
What characteristic does a static array have?
A fixed capacity
How does a circular queue work?
Reuses empty slots at the front of the array. When the rear index pointer reaches the last position, it wraps around to point at the start.