In computer science, a deque (short for double-ended queue) is a data structure for which elements can be added to or removed from the front or back. This differs from a normal queue, where elements can only be added to one end and removed from the other. A deque maintains a slightly modified FIFO structure, doing so using each end as both left and right. A common implemenation of a deque uses a doubly linked list. Computer science is the study of the theoretical foundations of information and computation and their implementation and application in computer systems. ... In providing services to people, and in computer science, transport and operations research a queue is a First-In-First-Out (FIFO) process â the first element in the queue will be the first one out. ... A binary tree, a simple type of branching linked data structure. ... In providing services to people, and in computer science, transport and operations research a queue is a First-In-First-Out (FIFO) process â the first element in the queue will be the first one out. ... FIFO is an acronym for First In, First Out. ... In computer science, a linked list is one of the fundamental data structures used in computer programming. ...
Deque is usually pronounced deck, possibly due to the conceptual similarity to a deck of cards, where a card can be dealt from or returned to either the face or patterned side.
Operations
The following operations are possible on a deque:
push_back
push_front
pop_back
pop_front
peek_back
peek_front
Complexity
In a doubly-linked list implementation, the Time complexity of all operations is O(1).
In an growing array, the amortized complexity of all operations is O(1).
In computer science, computational complexity theory is the branch of the theory of computation that studies the resources, or cost, of the computation required to solve a given problem. ... It has been suggested that Landau notation be merged into this article or section. ... In computational complexity theory, amortized analysis is the time per operation averaged over a worst_case sequence of operations. ...