简体   繁体   中英

Advantages of circular queue over stack in java

I was asked the advantages of using circular queue over stack. I couldn't think of any. Searching the internet doesn't give clear answer. Is there any other advantage?

Perhaps you're missing the obvious here - forgetting the 'circular' part, what's the advantage of a queue over stack? Well, one's a queue , ie FIFO semantics, and the other's a stack , ie LIFO semantics.

The advantage of a queue over a stack is that you process items in order. If you know you can process an item in a particular amount of time then you can calculate a throughput and that can give you a rough estimate of how long an item will be in the queue before it's processed.

Queue's are often implemented as circular lists. They don't have to be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM