๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Programming Concepts Beginner

What is Stack?

A data structure that follows Last-In-First-Out (LIFO) ordering, where elements are added and removed from the same end (top).

Stacks support push (add to top) and pop (remove from top) operations, both in O(1). The call stack tracks function calls and local variables. Stacks are used in undo operations, expression evaluation, backtracking algorithms, and depth-first search.

The function call stack is fundamental to how programs execute - each function call pushes a stack frame, and returning pops it. Stack overflow occurs when the stack exceeds its memory limit, typically from infinite recursion.

Related Terms

Closure
A function that captures and retains access to variables from its enclosing scope, even after that scope has finished executing.
Hash Table
A data structure that maps keys to values using a hash function, providing average O(1) time complexity for lookups, insertions, and deletions.
Stack vs Heap
Two memory regions: the stack stores function call data with automatic cleanup, while the heap stores dynamically allocated objects.
Clean Code
Code that is easy to read, understand, and maintain - following consistent conventions, meaningful naming, and single-responsibility functions.
Technical Debt
The implied cost of additional rework caused by choosing a quick solution now instead of a better approach that would take longer.
Twelve-Factor App
A methodology of twelve best practices for building modern, scalable, maintainable software-as-a-service applications.
View All Programming Concepts Terms โ†’