Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements.
Now, in this queue what will be condition for FULL and EMPTY?
Full:(REAR+1)%n== FRONT
(or)
(FRONT+1)%n==REAR
(or)
FRONT==REAR
Empty: FRONT==REAR
(or)
REAR== FRONT
--------------------------------------------------------------------------------------------------
I think FRONT== REAR and REAR==FRONT means same, So, both will give correct result in case of Empty . It is a checking if both pointer pointing same or not. But for FULL it will not give correct result. because, Rear cannot go same location as Front locating . But Front pointer can come and point same location as rear.
So, in case of Full, Rear point array that must be array index more than Front
Am I right?
Then what equation will valid?