A Practical Guide to the Stack Data Structure
To help me conceptualize stacks and also some of their functions, I usually think of it as a stack of books or a stack of Jenga bricks as you can see on the cover image above. A stack is a linear data structure that functions on the Last In First Out (LIFO) principle which means that the last element in a stack is the first one to be removed, just like a stack of books.
Stack Implementation in Python
Stack Implementation in Go
Uses of Stacks
It is used to evaluate arithmetic operations.
It is used in backtracking, a recursive algorithm used for solving optimization problems.
It is used for delimiter checking.
It is used to reverse a given set of data.
It is used to process function calls.
Subscribe to my newsletter
Read articles from Kelyn Njeri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Kelyn Njeri
Kelyn Njeri
Senior Software Engineer with a knack for Python, Golang, TypeScript, and Elixir. I am also a bit of a Rust enthusiast. I am excited by all things scalability and microservices. Join me on this journey to becoming a unicorn 10x Engineer.