A queue is an ordered linear table. The insertion and deletion operations of the queue are performed at two different endpoints of the linear table. In real life, queue applications can be seen everywhere, such as queuing to buy things and hospitals. Registration systems, etc. all use a queue structure.
Queue
Queue (Queue) is an ordered linear list, queue insertion and deletion The operations are performed on two different endpoints of the linear table
Usually, the end where the data enters is called the "queue tail", the end where the data goes out is called the "queue head", and the end where the data elements enter the queue is called The process is called "enqueuing" and the process of dequeuing is called "dequeuing".
Operation set: generate queue, determine whether it is full, push into the queue, determine whether it is empty, remove the queue
Implementation method: sequential storage, chain storage
In real life, queue applications can be seen everywhere, such as queuing to buy XXX, hospital registration systems, etc., which all use the queue structure.
Take queuing to buy tickets, for example, all people line up in a line, and those who arrive first go to the front, and those who arrive later can only wait in line from the end of the line. Everyone in the line must wait until they After everyone in front has successfully purchased their tickets and exited from the front of the queue, it is their turn to buy tickets. Isn't this a typical queue structure?
The above is the detailed content of What is the use of queue?. For more information, please follow other related articles on the PHP Chinese website!