37.5k views
4 votes
I have implemented the queue with a linked list, keeping track of a front pointer and a rear pointer. Which of these pointers will change during an insertion into an EMPTY queue?

a. Neither changes
b. Only front ptr changes.
c. Both change
d. Only rear _ ptr changes.

1 Answer

3 votes

Final answer:

Both the front and rear pointers change during an insertion into an empty queue implemented with a linked list.

Step-by-step explanation:

In a queue implemented with a linked list, when inserting into an EMPTY queue, both the front pointer and the rear pointer will change.

Initially, both the front and rear pointers will be pointing to NULL. When a new element is inserted, it becomes both the front and rear element of the queue. This means that both the front and rear pointers need to be updated to point to the new element.

User Frelling
by
8.0k points