1. What is a queue?
Queues are linear tables that allow only inserts at one end and deletions at the other end.
2. Characteristics of the queue:
A queue is an advanced first-out linear table that allows the insertion of one end to be called the tail of the team, allowing the end of the deletion to be called the team head.
3. What is the shortage of queue order storage?
Using array-implemented sequential storage, when a queue operation is made, all elements need to move one bit forward, with very low performance.
4. What is a loop queue?
The sequential storage structure of a queue's end-to-end is called a circular queue.
As shown in the figure: Front remembers the bottom of the team header element, rear remembers the next element of the team tail element.
Attention:
1. Only by the equation Front=rear is unable to judge whether the team is empty or the team is full, so we agreed that when the queue head pointer front the next position in the tail pointer rear, the queue is "full", and when the queue is full, there is also an idle position in the array.
2. We can also set a flag variable flag, when (front = = Rear && flag = = 0) The queue is empty, when (front = = Rear && flag = 1) The team is listed full.
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/