Stacks

A stack is a type of data structure where the last item you add to the data structure will be the first item that gets removed from the data structure. It is thus referred to as a LIFO (last in, first out) structure. Stacks are generally implemented in two ways, the first of which, arrays, will be covered in this section. They can also be easily implemented by way of linked lists. Stacks have two operations that can be performed on them: pushing (adding an item to the stack) and popping (removing the most-recently added item from the stack).