What is Queue?
A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first. It takes constant time to add or remove an element in a queue.
Queues should be used over arrays when we need to work with data in the FIFO form.
Limitation of Queue: It can access only one element at a time.
Basic skeleton of queue: Below example run using “$node skeleton.js” command to get basic queue skelton.
After Enqueuing ’25’ by calling queue1.enqueue(25) function of rear changes to 25.
- p5.js | Dequeue Operation in Queue
- PHP | SplQueue::enqueue() Function
- p5.js | Pop Operation in Stack
- p5.js | Push Operation on Stack
- How to perform click-and-hold operation inside an element using jQuery ?
- D3.js queue() Function
- jQuery | queue() with Examples
- D3.js queue.defer() Function
- D3.js queue.abort() Function
- PHP | Ds\Queue Functions Complete Reference
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.