Professional Documents
Culture Documents
DSA Array Matrix Write & Earn Strings Hashing Linked List Stack Queue Binary Tree
Deque or Double Ended Queue is a generalized version of Queue data structure that
Operations on Deque : Mainly the following four basic operations are per formed on
queue:
deleteLast(): Deletes an item from the rear of Deque. In addition to the above
Applications of Deque : Since Deque suppor ts both stack and queue operations, it can be
used as both. The Deque data structure suppor ts clock wise and anticlock wise rotations
in O(1) time which can be useful in cer tain applications. Also, the problems where
elements need to be removed and or added to both ends can be efficiently solved using
Deque. For example see the Maximum of all subarrays of size k problem., 0-1 BFS, and
Find the first circular tour that visits all petrol pumps. See the wiki page for another
example of the A-Steal job scheduling algorithm where Deque is used as deletions
https://www.geeksforgeeks.org/deque-set-1-introduction-applications/ 1/5
11/7/22, 9:34 PM Deque | Set 1 (Introduction and Applications) - GeeksforGeeks
Java provides the Deque inter face. See this for more details. Deque in Java Deque in
P ython
circular array. In both implementations, we can implement all operations in O(1) time.
We will soon be discussing the C/C++ implementation of the Deque Data structure.
Implementation of Deque using circular array Please write comments if you find the
above codes/algorithms incorrect, or find other ways to solve the same problem.
Recommended
https://www.geeksforgeeks.org/deque-set-1-introduction-applications/ 2/5
11/7/22, 9:34 PM Deque | Set 1 (Introduction and Applications) - GeeksforGeeks
Previous Next
Ar ticle Contributed By :
GeeksforGeeks
https://www.geeksforgeeks.org/deque-set-1-introduction-applications/ 3/5