In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a nonempty queue? A) only front pointer b) only rear pointer c) both front and rear pointer d) none of the mentioned
Answers
Answered by
11
Queue follows FIFO logic. Which means insertion take place at one end and deletion in other end.
So, only front pointer would change during the insertion and rear pointer while deletion.
Hence, only front pointer.
So, only front pointer would change during the insertion and rear pointer while deletion.
Hence, only front pointer.
Answered by
0
The answer is option a)
Explanation:
- The queue operates on a first-in, first-out (FIFO) basis.
- This signifies that insertion occurs on one end and deletion occurs on the other.
- As a result, only the front pointer changes during insertion and the rear pointer changes during deletion.
- As a result, only the front pointer is used.
The front pointer is:
- The front pointer contains the location of the queue's first element, while the back pointer contains the address of the queue's last member.
- At the back end, insertions are made, and at the front end, deletions are made.
- If both the front and back of the queue are NULL, the queue is empty.
Similar questions
Art,
6 months ago
English,
6 months ago
Psychology,
1 year ago
English,
1 year ago
English,
1 year ago