Stack vs Queue
Ahoï everyone, ( just wanted to try it, since i consider you captains of your life ships) today we will talk about something technical (boring…..but wait, it might be “interesting”).
Well the subject for today is Stack vs Queue.
So let’s begin with talking about both at he same time and then we will see the difference between those two.
Stack and Queue are both storage elements in Javascript. What is storage? It is very simple : How to put your data in a specific memory slot and how to reuse it.
Now the difference :
Stack is like having a box where you put pieces of data in a successive way…so the first piece of data will be atthe bottom of the box and the last piece of data at the surface. That’s why Stack is known as First In Last Out type of data storage or simply FILO.
Queue on the other hand is like Stack but imagine the “box” being horizontal and open from both sides. So once you store your data there it will go from one end to the other ….basically the first data in is the first data out, or FIFO.
Now that I finished writing about JavaScript , I look forward to writing to you about something else next time.
Cheers.