Skip to content

Lesson 14 · Python

Data Structures: Stacks, Queues & Hash Maps

Pick the structure that matches your access pattern: stacks for last-in-first-out, queues for fair processing, and dict hash maps for instant key lookup.

Prerequisites: Algorithms: Recursion & Divide-and-Conquer

Learning objectives
By the end of this lesson, you will be able to:
  • Use a list as a stack with append and pop
  • Use collections.deque as a queue with popleft
  • Explain how hash tables turn hashable keys into average O(1) lookups
  • Match each structure to the access pattern it serves: LIFO, FIFO, by key