What is the difference between stack and queues?

1 answer

Answer

1065809

2026-07-26 08:05

+ Follow

A queue is a first-in-first-out (FIFO) data structure, while a stack is a first-in-last-out (FILO) data structure.

Think of a queue as a line to get on a ride at a theme park, you get on the ride in the order than you joined the line.

Think of a stack as a pile of heavy objects stacked on top of each other, new objects get put on top of the pile, and when you take objects off of the pile you must take off the one that is currently on top, which is also the one you most recently added. The first object placed on the stack is at the bottom and will be the last one removed.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.