What is the difference between the stack and the queue when it comes to data storage?

有帮助吗?

解决方案

A stack works like a tray of dirty dishes, the first one you put on the stack will be the last one out of the stack. The last one on the stack will be the first one popped off the stack (Last in first out).

The queue works in the same way a line at the supermarket works. The first one in a queue will be the first one out of the queue(First in first out).

其他提示

Stack - first in first out.

Queue - first in last out

Various methods to implement

Does that answer your homework

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top