Question:

Which data structure allows insertion and deletion at both ends?

Show Hint

A Deque can be used to implement both a Stack and a Queue. If you only use one end, it acts as a Stack; if you use opposite ends for insertion and deletion, it acts as a Queue.
Updated On: Jul 4, 2026
  • Stack
  • Queue
  • Deque
  • Array
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Concept: A Double-Ended Queue, or Deque, is a generalized version of a Queue.
Flexibility: It is a linear data structure that does not follow a strict LIFO or FIFO rule.
Operations: It supports four primary operations: push_front, push_back, pop_front, and pop_back.

Step 1:
Evaluating restricted data structures.
A Stack is restricted to one end for both operations (LIFO). A standard Queue allows insertion at one end and deletion at the other (FIFO).

Step 2:
Defining the Deque structure.
The term "Deque" stands for "Double-Ended Queue." It specifically allows elements to be added or removed from either the front or the back.

Step 3:
Conclusion based on structural properties.
Since the question asks for access at both ends for both operations, Deque is the correct choice.
Was this answer helpful?
0
0