If circular queue is implemented using array having size MAX_SIZE in which array index starts with 0, front points to the first element in the queue, and…
If circular queue is implemented using array having size MAX_SIZE in which array index starts with 0, front points to the first element in the queue, and rear points to the last element in the queue. Which one of the following conditions is used to specify that the circular queue is empty?
Show answerHide answer
Correct answer: (A) Front = rear = −1
Explanation
With this convention, front and rear start at −1. Front = rear = −1 means the queue is empty, and front = rear ≥ 0 means it holds one element.