GATE CS 2017, set 2 · Question 13 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
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 O(1) time?
I. Next pointer of front node points to the rear node.
II. Next pointer of rear node points to the front node.
- (A) I only
- (B) II only
- (C) Both I and II
- (D) Neither I nor II
Answer
Answer (B)
Answer from the official GATE CS 2017 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes