Practice mode Data Structures

What is a deque?

Correct answer B. A queue that allows insertion and deletion at both ends

Explanation

A double-ended queue, or deque, supports adding and removing at both the front and the back. It can therefore act as a stack or a queue. Python's collections.deque and C++ std::deque provide fast operations at both ends. Removing the highest-priority element describes a priority queue, and restricting deletion to the front is an ordinary queue.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.