Which one of the following is the overflow condition if a circular queue is implemented using array having size MAX?

A)  rear=MAX
B)  rear= MAX-1
C)  front=(rear+1) mod max
D)  None of the above

Correct Answer :   front=(rear+1) mod max


Explanation : front=(rear+1) mod max. The overflow condition for the linear queue is rear =MAX-1 as there is no space left in the Queue if rear = MAX-1. On the other hand, in a circular queue, the overflow condition is front=(rear+1) mod max because the last element is connected to the first element in a circular queue.