๐ŸŽ 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

Clean Code
Code that is easy to read, understand, and maintain โ€” following consistent conventions, meaningful naming, and single-responsibility functions.
Concurrency
The ability of a program to manage multiple tasks that can make progress during overlapping time periods.
Immutable Object
An object whose state cannot be modified after creation, providing thread safety and predictable behavior in concurrent systems.
Recursion
A programming technique where a function calls itself to solve a problem by breaking it into smaller subproblems.
Data Structure
A way of organizing and storing data in a computer so it can be accessed and modified efficiently.
Unit Testing
Testing individual components or functions of a program in isolation to verify they work correctly.
View All Programming Concepts Terms โ†’