π₯ Stacks Explained Like You're 5
Building AI systems and writing about how they actually work. Master of AI @ University of Technology Sydney. Previously B.Tech CS with focus on IoT. I believe the best way to learn is to explain. That's why I'm documenting tech concepts with simple analogies (@sreekarreddy.com). AWS Certified β’ Azure AI Certified β’ Neo4j Professional β’ Google Data Analytics When not coding: exploring Sydney, working on side projects, and teaching tech to anyone who'll listen.
A pile of pancakes, last in first out
Day 38 of 149
π Full deep-dive with code examples
The Pancake Stack
Mom makes pancakes and stacks them:
π₯ β Last one made (on top)
π₯
π₯
π₯ β First one made (on bottom)
Which pancake do you take first? The top one!
Last In, First Out = LIFO
Stack Operations
Two main things you can do:
- Push: Add to top
- Pop: Remove from top
Push "A" β [A]
Push "B" β [A, B]
Push "C" β [A, B, C]
Pop β [A, B] (returns C)
Pop β [A] (returns B)
Real Uses
Undo/Redo: Each action is pushed. Undo pops the last one!
Browser Back Button: Each page is pushed. Back pops!
Function Calls:
main() calls
login() calls
validate()
When validate() finishes, pop back to login()!
In One Sentence
Stacks store data like a pile where you typically add/remove from the top (last in, first out).
π Enjoying these? Follow for daily ELI5 explanations!
Making complex tech concepts simple, one day at a time.