WBJECA 2025 — Computer PYQ
WBJECA | Computer | 2025What is a dequeue?
Choose the correct answer:
- A.
A queue implemented with both singly and doubly Linked Lists
- B.
A queue with insert/delete defined for front side of the queue
- C.
A queue with insert/delete defined for both front and rear ends of the queue
(Correct Answer) - D.
A queue implemented with a doubly Linked List
A queue with insert/delete defined for both front and rear ends of the queue
Explanation
A Deque (short for Double-Ended Queue) is a generalized linear data structure that supports insertion and deletion operations at both the front and the rear ends. Unlike a standard queue, which follows the First-In-First-Out (FIFO) principle with operations at restricted ends, a deque offers more flexibility.
If we represent the deque as an array of elements D={e1,e2,…,en}, the operations can be defined as follows:
Push/Pop Front: Modifies the element at the index 1.
Push/Pop Rear: Modifies the element at the index n.
Mathematically, let S be the size of the deque. The number of elements after a series of operations can be tracked:
Snew=Sold+Δ
Where Δ=1 for an insertion and Δ=−1 for a deletion. Since a deque allows these operations at both ends, the complexity for accessing the ends remains O(1):
T(insert/delete)=O(1)
While a deque can be implemented using a doubly linked list (as mentioned in option D), that is an implementation choice, not the definition of the data structure itself. Option (C) accurately describes the functional definition of a deque.
