Interface for a high-performance stack with LIFO (Last-In, First-Out)
behavior.
This interface defines a mutable stack data structure where elements are
added to and removed from the top, following the Last-In, First-Out
principle. The implementation uses a dynamic array for optimal performance,
providing O(1) operations for both push and pop operations.
LIFO Behavior:
push: Adds elements to the top of the stack
pop: Removes and returns elements from the top of the stack
The last element added is the first element to be removed
Performance Characteristics:
Push: O(1) amortized (O(n) when buffer needs resizing)
Pop: O(1) always
Size/isEmpty: O(1) always
Memory efficient with automatic garbage collection of removed elements
Interface for a high-performance stack with LIFO (Last-In, First-Out) behavior.
This interface defines a mutable stack data structure where elements are added to and removed from the top, following the Last-In, First-Out principle. The implementation uses a dynamic array for optimal performance, providing O(1) operations for both push and pop operations.
LIFO Behavior:
Performance Characteristics:
Use Cases: