On this page you can get a detailed analysis of a word or phrase, produced by the best artificial intelligence technology to date:
In computer science, a double-ended queue (abbreviated to deque, pronounced deck, like "cheque") is an abstract data type that generalizes a queue, for which elements can be added to or removed from either the front (head) or back (tail). It is also often called a head-tail linked list, though properly this refers to a specific data structure implementation of a deque (see below).
A deque is a data structure that allows insertion and removal of elements from both ends. This is different from a queue, which only allows insertion at one end and removal from the other end, following a first-in, first-out (FIFO) order. Deques can have several sub-types, including input-restricted deques, where deletion can be made from both ends but insertion can only be made at one end, and output-restricted deques, where insertion can be made at both ends but deletion can only be made from one end.
Deques are a fundamental data structure in computing, and many other data structures can be implemented using them. For example, queues and stacks can both be considered specializations of deques. The basic operations on a deque are adding elements to either end and removing elements from either end. Additionally, peek operations allow the value at one end to be examined without removing it.
There are at least two common ways to efficiently implement a deque: with a modified dynamic array or with a doubly linked list. Dynamic array-based deques, also called array deques, can grow from both ends and have all the properties of a dynamic array, such as constant-time random access and good locality of reference, with the addition of amortized constant-time insertion and removal at both ends. Three common implementations of array deques include storing deque contents in a circular buffer, allocating deque contents from the center of the underlying array, and storing contents in multiple smaller arrays. The other common implementation of deques is with a doubly linked list, which allows for constant-time insertion and removal at both ends, but with less efficient random access than dynamic array-based implementations.