Recall & Review
beginner
What is a queue in data structures?
A queue is a collection where elements are added at the back and removed from the front, following the First-In-First-Out (FIFO) principle.
Click to reveal answer
beginner
What does the 'enqueue' operation do in a queue?
The 'enqueue' operation adds an element to the back (end) of the queue.
Click to reveal answer
beginner
What does the 'dequeue' operation do in a queue?
The 'dequeue' operation removes and returns the element from the front of the queue.
Click to reveal answer
intermediate
Why do we need to check if the queue is full before enqueueing in an array-based queue?
Because the array has a fixed size, if all positions are filled, we cannot add more elements without overwriting or resizing.
Click to reveal answer
intermediate
What happens when the front index passes the end of the array in a simple array queue implementation?
Unused space is left at the beginning of the array and cannot be reused; this is why circular queues are used to reuse array space.
Click to reveal answer
In a queue implemented using an array, where do we add new elements?
✗ Incorrect
New elements are always added at the back of the queue following FIFO.
What does the 'front' pointer/index represent in an array-based queue?
✗ Incorrect
The 'front' points to the element that will be removed next.
What is a major limitation of a simple array queue without circular logic?
✗ Incorrect
After dequeuing, the front moves forward and space behind is wasted without reuse.
What condition indicates that the queue is empty in an array implementation?
✗ Incorrect
When front and rear are equal, no elements are in the queue.
What is the time complexity of enqueue and dequeue operations in an array-based queue?
✗ Incorrect
Both enqueue and dequeue operations take constant time O(1).
Explain how enqueue and dequeue operations work in a queue implemented using an array.
Think about where elements enter and leave the queue.
You got /4 concepts.
Describe the problem with a simple array queue and how a circular queue solves it.
Imagine the array as a circle rather than a line.
You got /4 concepts.