Suggest an editImprove this articleRefine the answer for “What is a stack as a data structure?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **stack** is a data structure that works on the LIFO (Last In, First Out) principle: last in, first out. **Key point:** the stack's core actions are push(x) (place an element on top) and pop() (remove the top element).Shown above the full answer for quick recall.Answer (EN)ImageA stack is a data structure that works on the **LIFO (Last In, First Out)** principle: *last in, first out*. Imagine a stack of plates: to take the bottom one, you need to remove everything on top of it. A stack has two basic actions: - **push(x)**: place an element on top of the stack, - **pop()**: remove the top element. Additionally, these are often used: - **peek() / top()**: view the top element without removing it, - **isEmpty()**: check whether the stack is empty. A stack is used in: - handling function calls (call and return), - undoing actions (undo in editors), - checking brackets, - implementing recursion and parsing expressions.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.