What is stack and queue in simple words? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is stack and queue in simple words?

Stack is a process of "Last In First Out " Queue is a process of "First In First Out"

28th Aug 2017, 12:04 PM
Mohamed Rizwan
Mohamed Rizwan - avatar
1 Answer
+ 2
Let me give you some Examples. When you place some objects one over another so that the last object placed must be put out first then it's a stack. For example- a stack of books on a table. You have to put out the books in the reverse order as you put them there i.e the book that you put last will be picked up first. However when the First element has to be put out First then it is a queue. For example- a queue for Railway tickets(Who come first, get first and go first)
28th Aug 2017, 12:30 PM
Mohd Zaid
Mohd Zaid - avatar