Question 51
Which Python module/class provides an optimal double-ended queue implementation for implementing stacks and queues with O(1) time complexity pops/appends from both ends?
collections.deque is implemented as a doubly linked list of memory blocks, providing O(1) performance for append/pop operations at both head and tail.