Correct option is C
A double-ended queue (deque) is a special type of linear data structure in which elements can be inserted and deleted from both the front and the rear ends. It generalizes the simple queue, where insertion is done at the rear and deletion at the front, by removing this restriction.
Important Key Points:
- A deque (double-ended queue) supports both enqueue and dequeue operations at both ends.
- It is useful in applications where flexible data insertion and deletion is needed (e.g., sliding window problems, task schedulers).
- Deques can be input-restricted or output-restricted, depending on whether insertion or deletion is restricted to one end.
Knowledge Booster:
- Simple queue: Allows insertion at rear and deletion from front only; does not support operations at both ends.
- Circular queue: A queue where the last position is connected back to the first to form a circle; insertion and deletion are still limited to rear and front respectively.
- Priority queue: Elements are inserted based on priority; not position-based (front/rear) but priority-based insertion and removal.