A deque is a data structure in which insertion and deletion can be performed at which ends?

Options

  • A. Only at the front
  • B. Only at the rear
  • C. Both front and rear
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. Both front and rear

Detailed Explanation

A deque (double-ended queue) allows insertion and deletion at both the front and rear. It combines characteristics of queues and stacks. A deque can be implemented using arrays or linked lists. Two special forms are an input-restricted deque, where insertion is restricted to one end, and an output-restricted deque, where deletion is restricted to one end. These distinctions are useful for DSA MCQs.