A stack is a data structure that follows the Last In, First Out (LIFO) principle, meaning the last item added is the first one to be removed. Think of it like a stack of plates; you can only take the top plate off without disturbing the others underneath. Stacks are commonly used in programming for tasks such as managing function calls and undo mechanisms in applications.
In a stack, two primary operations are performed: push, which adds an item to the top, and pop, which removes the item from the top. Stacks can be implemented using arrays or linked lists, making them versatile for various applications in computer science and software development.