wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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
Both I and II
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
II only
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
C
I only
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
Neither I nor II
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is B II only
Since insertion in a queue are always form REAR and deletion is always form FRONT. Hence having the next Pointer of REAR node pointing to the FRONT node will lead to both insertion and deletion operations in O(1) time.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Standard Meridian
GEOGRAPHY
Watch in App
Join BYJU'S Learning Program
CrossIcon