+ 12

Which of the following uses more: Stack or queue? Why?

as i know stack and queue is important to learn, but how to use them in project? or need to use both of them?

5th Jul 2017, 2:04 PM
Assylbek
Assylbek - avatar
2 Respuestas
+ 6
Stacks are used a lot more, for a bunch of things. You can use them to simulate recursion in programming languages, make calculators, test validity of expressions etc. One common stack use is to make undo/redo edit operations in applications. You push editing operations on the stack, and when you want to undo it, you pop it.
5th Jul 2017, 2:58 PM
Karl T.
Karl T. - avatar
+ 1
stack is used when you need FILO access, the queue is used when you need FIFO access or access by priority (priority queue)
5th Jul 2017, 2:47 PM
soman