When a circular queue is implemented in an array of the following condition holds when there is only one element in the queue?

When a circular queue is implemented in an array of the following condition holds when there is only one element in the queue? Correct Answer Front=Rear – 1

Concept:

In circular queue, last element’s position is connected with the first element’s position. All other operations are same as queue. It also follows FIFO property (First in first out).

Explanation:

A circular queue is shown as:

[ alt="F1 Raju.S 04-09-2020 Savita D2" src="//storage.googleapis.com/tb-img/production/20/09/F1_Raju.S_04-09-2020_Savita_D2.png" style="width: 207px; height: 155px;">

For storing the front and rear in circular queue, we use rear = (rear + 1) % size and front = (front + 1) % size.

A circular queue will be full when Front = -1 and Rear = max – 1.

When a circular queue is implemented in an array, then when there is only one element in the queue, then Front=Rear – 1.

Related Questions

A teacher asked the class to subtract 5 from 75.70% of the class said: 25. Their work was shown as: \(\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} 7&5 \end{array}}\\ {\underline {\begin{array}{*{20}{c}}\ { - 5} \ \ \ &{} \end{array}} }\\ {\underline {\begin{array}{*{20}{c}} 2&5 \end{array}} } \end{array}\) Which of the following describes the most appropriate remedial action that the teacher should take to clarify this misconception?