Recall & Review
beginner
What does the enqueue operation do in a queue?
It adds a new element to the end (rear) of the queue, following the First-In-First-Out (FIFO) principle.
Click to reveal answer
intermediate
In a queue implemented using an array, what happens when the rear index reaches the maximum size?
The queue is considered full, and no more elements can be added unless some are dequeued or the queue is reset (circular queue can help here).
Click to reveal answer
beginner
What is the time complexity of the enqueue operation in a queue?
The time complexity is O(1) because adding an element at the rear is a constant-time operation.
Click to reveal answer
intermediate
Show the basic steps of enqueue operation in a linked list based queue.
1. Create a new node with the data.<br>2. Set the next pointer of the current rear node to the new node.<br>3. Update the rear pointer to the new node.<br>4. If the queue was empty, set front pointer to the new node too.
Click to reveal answer
beginner
What error condition should be checked before enqueueing in a fixed-size queue?
Check if the queue is full (rear index is at max size - 1). If full, enqueue should not proceed to avoid overflow.
Click to reveal answer
What does the enqueue operation add to a queue?
✗ Incorrect
Enqueue adds an element at the rear of the queue.
What happens if you try to enqueue in a full fixed-size queue?
✗ Incorrect
Trying to enqueue in a full queue causes overflow error.
In a linked list queue, what pointer is updated during enqueue?
✗ Incorrect
The rear pointer is updated to the new node during enqueue.
What is the time complexity of enqueue operation in a queue?
✗ Incorrect
Enqueue is a constant time operation, O(1).
Which data structure principle does enqueue follow?
✗ Incorrect
Queue follows FIFO, so enqueue adds at the rear.
Explain the steps involved in the enqueue operation for a queue implemented using an array.
Think about how the rear index changes and what to do if the queue is empty or full.
You got /4 concepts.
Describe how enqueue works in a linked list based queue and how it differs from array implementation.
Focus on pointers and dynamic memory.
You got /4 concepts.
