A linear data structure operating under the Last-In, First-Out (LIFO) principle. The most recently inserted element is situated at the top and must be the first element accessed or removed.
Stacks allow insertions and deletions solely at one end, termed the Top. Common computer science applications include call stack execution, expression evaluation, syntax parsing, and undo-redo buffers.
Appends value x to the top of the stack. Signals an Overflow condition if capacity is reached.
Removes and returns the element at the top. Signals an Underflow condition if the stack is empty.
Inspects the top element without altering the stack pointer or element count.
Boolean status checks validating stack constraints prior to performing mutations.