Python Deque

Python Deque is a double-ended queue. It has two ends, a front and a rear end. In Python, we can implement deque using a collection module. Deque provides a fast update, insert and delete operations than a data list structure. For appending and pop operation, deque provides time complexity O(1).

We can add or remove the item from deque either ends. The new item can be added from the front or rear end. The characteristics of the deque are the same as a stack and queue, but it does not need to follow the Last In First Out (LIFO) or First In Last Out (FILO) order.

Posted on Apr 8, 2022

More by pratik bais

View profile