A stack is a container of objects that are inserted and removed according to the LIFO (last-in first-out) principle.
It is a limited access data structure. Elements can be added and removed from the stack only at the top.
push
adds an item to the top of the stack, pop
removes the item from the top.
Easy analogy is to think of a stack of books.
A stack is a recursive data structure. A stack is either empty or it consists of a top and the rest which is a stack.
Container of objects that are inserted and removed according to the first-in first-out FIFO principle.
Example: line of students getting food. New additions to a line is made to the back of the queue, while removal happens in the front.