Doubly Linked List. in A Deque, Two Pointers Are Maintained, LEFT and RIGHT, Which Point To
Doubly Linked List. in A Deque, Two Pointers Are Maintained, LEFT and RIGHT, Which Point To
which the elements can be inserted or deleted at either end in constant time. It is also known
as a head-tail linked list because elements can be added to or removed from either the front
(head) or the back (tail) end. However, no element can be added and deleted from the middle.
In the computer’s memory, a deque is implemented using either a circular array or a circular
doubly linked list. In a deque, two pointers are maintained, LEFT and RIGHT, which point to
either end of the deque. The elements in a deque extend from the LEFT end to the RIGHT end
and since it is circular, in a deque of N elements, Nth element of deque is followed by the first
element of the deque.
Input restricted deque: In this dequeue,insertions can be done only at one of the
ends,while deletions can be done from both ends.
Output restricted deque: In this dequeue,deletions can be done only at one of the
ends,while insertions can be done on both ends.
Algorithm Of Dequeue
There are four basic operations in usage of Deque that we will explore: