A stack is a Last In, First Out (LIFO) data structure where items added last are removed first. When an item is added to a stack, it is placed on the "top" of the stack, and when an item is removed it is taken from the top. Items are removed from the stack in the reverse order that they were inserted. The two main operations on a stack are PUSH, which adds an item to the top, and POP, which removes and returns the top item.
Related topics: