Disadvantage of circular queue?

Praveen Kumar picture Praveen Kumar · Feb 16, 2013 · Viewed 17k times · Source

Recently, in an interview I was asked the disadvantage of using circular queue. I couldn't think of any. Searching the internet the only answer I found is that it's difficult to implement than linear queue :). Is there any other disadvantage?

Answer

Justin picture Justin · Sep 16, 2013

I would say the biggest disadvantage to a circular queue is you can only store queue.length elements. If you are using it as a buffer, you are limiting your history depth.

Another smaller disadvantage is it's hard to tell an empty queue from a full queue without retaining additional information.