You’ve learned that Python’s collections module provides a data type called deque, which is specially designed for fast and memory-efficient append and pop operations on both ends. You’ve explored the deque data structure and its core features, as well as how they differ from regular Python lists. With deque, you can code your own queues and stacks at a low level in an efficient and Pythonic way.
In this video course, you’ve learned how to:
- Create and use Python’s
dequein your code - Efficiently append and pop items from both ends of a
deque - Use
dequeto build efficient queues and stacks in Python - Decide when to use
dequeinstead oflist
You also coded a few practical examples that helped you approach some common use cases of deque in Python.
Resources mentioned in this lesson: