226k views
1 vote
Determine the data structure in which elements can be inserted or removed from both the ends but not from the middle is:

(a) Queue
(b) Circular queue
(c) Dequeue
(d) Priority queue

1 Answer

5 votes

Final answer:

(c) Dequeue, a data structure that allows insertions and deletions at both ends but not the middle, offering more flexibility than other types of queues.

Step-by-step explanation:

The correct answer is option (c) Dequeue. A dequeue, or double-ended queue, is a type of data structure that allows the insertion and removal of elements from both ends, but not from the middle.

This flexibility distinguishes it from the simple queue, which only allows insertion at the back and removal from the front, and the priority queue, where elements are removed according to their priority, not their position.

Unlike the circular queue, which is a variation of queue where the last position is connected back to the first position to make a circle, the dequeue doesn't enforce any specific order for processing elements, allowing more versatile operations.

User Marcos Arruda
by
8.3k points