for circular arrays Queues, is a scenario possible where back < front and size < capacity?
or is that when back< front, size always equals capacity?
Thank You
Yes, back < front and size < capacity is valid state in a circular buffer/queue. Note that size is generally implicit and calculated as (back-front)%capacity
. The Wikipedia article on circular buffers has a great description of how circular buffers function: http://en.wikipedia.org/wiki/Circular_buffer
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.