[
next
] [
prev
] [
prev-tail
] [
tail
] [
up
]
1.7.1
Circule Queue
circular array representation of a queue
Initial condition : front = rear = 0
Empty queue: front –> rear
Full: (rear+1)%length –> front
front point to an empty cell. So at mast it can save length-1 elements.
push only increase rear, so if (rear+1)%length –> front, means rear catch up front, it means full.
pop only increase front, so if front –> rear, means front catch up rear, it means empty.
[
next
] [
prev
] [
prev-tail
] [
front
] [
up
]