File:Data_Queue.svg · Wikimedia Commons · See Wikimedia Commons
Key facts
- Operation
- Average
- Search
- O( n )
- Insert
- O(1)
- Delete
- O(1)
- Space
- O( n )
via Wikipedia infobox
~12 min read
Encyclopedic overview
In computer science, a queue is an abstract data type that serves as an ordered collection of entities. By convention, the end of the queue where elements are added is called the back, tail, or rear of the queue. The end of the queue where elements are removed is called the head or front of the queue. The name queue is an analogy to the words used to describe people in line to wait for goods or services. It supports two main operations.
Enqueue, which adds one element to the rear of the queue
Excerpted from Wikipedia’s “queue” article, available under the CC BY-SA 4.0 licence.