filmov
tv
Stack & Queue

Показать описание
Do you know the difference between a stack and a queue? They may seem similar at first, but they have some important differences.
A stack is like a pile of papers on your desk. When you add a new paper to the pile, you put it on top. And when you want to take a paper from the pile, you take the one on top.
This is called the last-in, first-out (LIFO) principle. The last item you put on the stack is the first one you take off.
A queue is like a line of people waiting to buy tickets at a concert. The first person in line is the first one to get a ticket, and the last person in line is the last one to get a ticket.
This is called the first-in, first-out (FIFO) principle. The first item you put in the queue is the first one you take out.
#datastructures #algorithm #dsalgo #shorts #cs #computerscience #coding #codingshorts #python #javascript
A stack is like a pile of papers on your desk. When you add a new paper to the pile, you put it on top. And when you want to take a paper from the pile, you take the one on top.
This is called the last-in, first-out (LIFO) principle. The last item you put on the stack is the first one you take off.
A queue is like a line of people waiting to buy tickets at a concert. The first person in line is the first one to get a ticket, and the last person in line is the last one to get a ticket.
This is called the first-in, first-out (FIFO) principle. The first item you put in the queue is the first one you take out.
#datastructures #algorithm #dsalgo #shorts #cs #computerscience #coding #codingshorts #python #javascript