Stack & Queue

Two ways to organize data — try the buttons to see how each one works.

Stack Last in, first out
Like a stack of plates. You add to the top. You remove from the top. The most recent item always leaves first.
No plates yet
Try adding a few plates, then removing one.

Queue First in, first out
Like a line at a coffee shop. New people join the back. The person at the front gets served first.
No one in line yet
Try adding a few people, then serving one.