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

Suppose a circular queue of capacity (n - 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array indeed variables respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are

A
full : (FRONT +1) mode n == REAR empty : REAR == FRONT
No worries! Weā€˜ve got your back. Try BYJUā€˜S free classes today!
B
full : REAR == FRONT
empty : (REAR + 1) mod n == FRONT
No worries! Weā€˜ve got your back. Try BYJUā€˜S free classes today!
C
full : (REAR + 1) mod n == FRONT empty : REAR == FRONT
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
full : (REAR + 1) mod n == FRONT empty : (FRONT + 1) mod n == REAR
No worries! Weā€˜ve got your back. Try BYJUā€˜S free classes today!
Open in App
Solution

The correct option is C full : (REAR + 1) mod n == FRONT empty : REAR == FRONT
So above condition can be specified as:

Full : (Rear + 1) mod n = front
Empty : Rear = front


flag
Suggest Corrections
thumbs-up
1
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Covalent Bonds
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon