- Snippet from Wikipedia: Double-ended queue
In computer science, a double-ended queue (abbreviated to deque), is an abstract data type that serves as an ordered collection of entities. It generalizes both a queue and a stack : elements can be added (enqueue) to or removed (dequeue) from either end. It provides similar services in computer science, transport, and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the deque performs the function of a buffer. The additional flexibility in managing the order of elements or the properties of some implementations may allow the improvement and optimization of certain algorithms.
As a general data class, the deque has some possible sub-types:
- An input-restricted deque is one where deletion can be made from either end, but insertion can be made at one end only.
- An output-restricted deque is one where insertion can be made at either end, but deletion can be made from one end only.
Despite their limitations these sub-types have many applications and their implementations may be simpler.
