Queues and Stacks
LIFO stands for Last In First Out and FIFO stands for First In First Out. The simplest analogy of a data stack is the stack of dirty dishes in your sink. When you are done using a dish, you stack it on top of the existing dirty dishes until you are ready to wash them.
When you are ready to wash them, you take the last dirty dish that you stacked and you wash that. In computer terminologies, we say you “popped” a dish.
The last dish you stacked is the first dish you washed. This is LIFO. The simplest analogy of a data queue is the line of people that forms in front of a checkout or order station. When you are ready to pay for your groceries and take them home, you might need to queue yourself in a line until it is your turn.
The first person to arrive at that queue will be the first person to be done with it. This is FIFO.