Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. 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.
    1. I only
    2. II only
    3. Both I and II
    4. Neither I nor II
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.



Your comments will be displayed only after manual approval.