-
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of the following statements is/are CORRECT for such a circular queue, so that insertion and deletion operations can be performed in 0 (1) time?
I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.
-
- I only
- II only
- Both I and II
- Neither I nor II
- I only
Correct Option: B
In circular queue next pointer of Rear node pointing to the Front Node will lead to insertion in a queue is always from REAR and deletion is always from FRONT node in Θ(1) time.
Hence, option (B) is correct.