Stacks, Queues, and the Shunting Yard Algorithm Explained Simply

Опубликовано: 19 Май 2026
на канале: Dev w/Sel
209
12

Ever wondered how a calculator really understands math like 3 + 4 * 2 / (1 - 5)?

In this video, I explain Stacks, Queues, Infix vs Postfix notation, and the Shunting Yard Algorithm, the exact logic used by compilers and calculators to evaluate expressions.

We’ll break down:
What LIFO and FIFO mean (using simple real-life examples)
How to convert Infix → Postfix step-by-step
How the Shunting Yard Algorithm works under the hood
And finally, how to evaluate a Postfix expression using a stack

This is the foundation for my upcoming “Build Your Own BC Calculator in C” video, where we’ll implement this algorithm from scratch!

Topics Covered:
Stacks • Queues • LIFO • FIFO • Infix • Postfix • Shunting Yard • Postfix Evaluation

Timestamps
0:00 - Intro
0:28 - What Is a Stack (LIFO, Push, Pop, Head)
1:49 - What Is a Queue (FIFO, Enqueue, Dequeue, Head & Tail)
2:39 - Infix vs Postfix Notation Explained
3:05 - The Shunting Yard Algorithm Overview
3:51 - Infix to Postfix Rules Step-by-Step
4:19 - Example: Converting Infix → Postfix (3 + 4 * 2 / (1 - 5))
6:42 - Postfix Evaluation (Stack Evaluator) Rules
8:18 - Example: Evaluating Postfix Expression Step-by-Step
9:59 - Outro / What’s Next

#programming #datastructures #algorithm #computerscience
#stack #queue #shuntingyard #postfix #infix
#cprogramming #learncoding #mybcproject