Recall & Review
beginner Click to reveal answer
What does 'enqueue' mean in the context of a queue data structure?
Enqueue means adding an element to the end (rear) of the queue.
beginner Click to reveal answer
Why is a linked list useful for implementing enqueue operation in a queue?
A linked list allows adding elements at the end efficiently without shifting elements, unlike arrays.
beginner Click to reveal answer
In enqueue using linked list, which pointer usually moves when a new element is added?
The 'rear' pointer moves to point to the newly added node at the end of the linked list.
intermediate Click to reveal answer
What happens if the queue is empty when we perform enqueue using a linked list?
Both 'front' and 'rear' pointers are set to the new node because it is the only element.
intermediate Click to reveal answer
Show the steps to enqueue an element '5' in a queue implemented with a linked list having elements 1 -> 2 -> 3 -> null.
1. Create a new node with value 5.
2. Set current rear node's next to new node.
3. Move rear pointer to new node.
Result: 1 -> 2 -> 3 -> 5 -> null
2. Set current rear node's next to new node.
3. Move rear pointer to new node.
Result: 1 -> 2 -> 3 -> 5 -> null
What pointer is updated when enqueueing a new element in a linked list queue?
✗ Incorrect
The rear pointer moves to the new node added at the end.
If the queue is empty, what happens during enqueue?
✗ Incorrect
When empty, both front and rear point to the new node as it is the only element.
What is the time complexity of enqueue operation using linked list?
✗ Incorrect
Enqueue is O(1) because we add at the rear directly without traversal.
Which of the following is NOT true about enqueue using linked list?
✗ Incorrect
Front pointer only moves when dequeue happens, not during enqueue unless queue was empty.
What does the linked list node contain in a queue implementation?
✗ Incorrect
Each node stores data and a pointer to the next node.
Explain how enqueue operation works in a queue implemented using a linked list.
Think about what happens when the queue is empty versus when it has elements.
You got /4 concepts.
Describe the state of the queue after enqueueing elements 1, 2, and 3 in order using a linked list.
Visualize the linked list nodes and pointers after each enqueue.
You got /3 concepts.
