+ 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?
2 ответов
+ 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.
+ 1
stack is used when you need FILO access, the queue is used when you need FIFO access or access by priority (priority queue)