Stacks & Queues
Module Contents
Understand Stacks (LIFO) and Queues (FIFO). The hardware reality of ‘Push’ and ‘Pop’. Why Recursion is just a Stack.
Master Push, Pop, Peek. Implement a MinStack in O(1) time. Understand why ArrayDeque is superior to Stack in Java.
Master FIFO. Implement Queues using Linked Lists and Ring Buffers (Circular Arrays). Understand the trade-offs.
Master the Monotonic Stack pattern. Solve the Next Greater Element problem in O(N) time.
Build a Calculator. Learn the Shunting-yard algorithm to convert Infix to Postfix (RPN) and evaluate expressions.
Solve the Hard Sliding Window Maximum problem in O(N) using a Monotonic Deque.
How Stacks and Queues are used in the real world: Browser History, Undo/Redo, CPU Scheduling, and Rate Limiting.
Review everything you learned about Stacks and Queues. Flashcards, Cheat Sheet, and Key Takeaways.
Stacks & Queues
[!NOTE] This module explores the core principles of Stacks & Queues, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.
1. Practice
[!NOTE] Looking for hands-on algorithmic exercises? We have migrated all coding challenges for this module into the Problem Vault to give you a centralized, focused practice environment.
Module Chapters
Introduction to Stacks & Queues
Introduction to Stacks & Queues
Start LearningStack Operations
Implementing the Stack
Start LearningValid Parentheses: LIFO in Action
Valid Parentheses: LIFO in Action
Start LearningQueue Implementations
Implementing the Queue
Start LearningMonotonic Stack
The Monotonic Stack Pattern
Start LearningExpression Evaluation
Building a Calculator
Start LearningSliding Window Maximum
The Hard Problem: Sliding Window Max
Start LearningReal World Applications
Where do we use them?
Start LearningModule Review: Stacks & Queues
Module Review: Stacks & Queues
Start Learning