← Back
Implement Stack using Array
This page demonstrates stack operations using a simple array.
Stack Operations
Push: Add an element to the top of the stack.
Pop: Remove the element from the top of the stack.
Peek: Get the element at the top of the stack without removing it.
isEmpty: Check if the stack is empty.
Follows LIFO (Last In, First Out) principle.
Time Complexity
Push:
O(1)
Pop:
O(1)
Peek:
O(1)
isEmpty:
O(1)
Stack Elements
Enter numbers separated by commas
Push
Pop
Peek
Stack Visualization