Q30: What are the primary data structures provided by the 'collections' module?
defaultdict: Returns default values for missing keys automatically.Counter: Hash map subclass tracking element frequencies.deque: Doubly linked list/array with fast $O(1)$ appends and pops at both ends.ChainMap: Groups multiple dictionaries into a single updates-searchable view.
Key Takeaways
defaultdict: Avoids key existence checks.deque: Fast double-ended queue ($O(1)$ operations).Counter: Element frequency counting.
Knowledge Check
What is the time complexity of popping an element from the LEFT side (popleft()) of a collections.deque?