arrow_left_alt Back to Blog

2Minutes: Stack & Queue (General Concept)

calendar_today July 23, 2026 | timer 2 min read |

The following topics in this blog heavily depend on these two concepts. Understanding them fully will make the next posts much easier.

What is Stack?


If you’ve ever washed dishes, you probably remember placing the clean plates on top of each other. The first cleaned plate ends up at the very bottom, and when you’re done washing, the last cleaned plate sits at the very top. What you’ve just done is stack the plates on top of each other. Now, you can refer to this group of plates, arranged in this specific order, as a stack.

Now, it’s lunch time, and we need a plate for our wonderful salad. How would you approach the stack of plates? Would you take one from the top or the bottom? Yes, from the top, of course. You take the last cleaned plate and use it. The first cleaned plate will be the last one to be used since we’re taking plates from top to bottom. This process is called LIFO (Last In, First Out).

A stack in programming does exactly the same thing—literally the same. Just replace the plates with different pieces of code that need to be executed, and everything else remains the same.

What is Queue ?


Queue is much more intuitive! Remember when you’re at school and go to the refectory for lunch? If you’re early, you’ll be at the head of the line. If you’re late, you’ll be at the tail of the line, waiting to be served. The first person in line receives their meal first, while that late lazy student gets their meal last—sounds much fairer to us as humans, right? 🙂

This is called FIFO (First In, First Out).

In programming, a queue works exactly the same way. The first task added to the queue is the first task to be processed, while the last task added waits until its turn.

That’s 2Minutes, see you in the next one !

Sources


https://www.geeksforgeeks.org/dsa/stack-data-structure

https://www.w3schools.com/dsa/dsa_data_stacks.php

https://www.geeksforgeeks.org/dsa/queue-data-structure

https://www.w3schools.com/dsa/dsa_data_queues.php

index.php