Back to All Algorithms
Stack
Category: Data Structures | Time: O(1) | Space: O(n)
Visualization
Visual representation of the data structure
Enter commands to start stack visualization.
About Stack
A linear data structure that follows the Last-In, First-Out (LIFO) principle. Elements are added (pushed) and removed (popped) from the same end, called the 'top'.
Code Editor
The code is for reference. Editing it won't affect the visualization.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Frequently Asked Questions
About Stack
Related Interview Questions
Practice with real problems