However, a disadvantage for circular queue is that the front and back cannot be used to distinguish between queue-full and queue-empty conditions.
Using a counter to keep the number items in the queue. • Initialize count to 0 during creation; Increment count by 1 during insertion; Decrement count by 1 during deletion. • count=0 -> empty; count=MAX_SIZE -> full
Is there any other solutions for Queue-Empty/Queue-Full problem?
Other approaches include: - using a boolean flag isFull (queue is full, set isFullFlag to true; set isFull flag to false) - Using an extra array location (and leaving at least one empty location in the queue)
Your welcome John
Alright, thanks for sharing this information with me!